Method and apparatus for encoding video, and method and apparatus for decoding video

ABSTRACT

Disclosed are a video encoding method and apparatus and a video decoding method and apparatus. The method of encoding video includes: producing a first predicted coding unit of a current coding unit, which is to be encoded; determining whether the current coding unit comprises a portion located outside a boundary of a current picture; and producing a second predicted coding unit is produced by changing a value of pixels of the first predicted coding unit by using the pixels of the first predicted coding unit and neighboring pixels of the pixels when the current coding unit does not include a portion located outside a boundary of the current picture. Accordingly, a residual block that is the difference between the current encoding unit and the second predicted encoding unit, can be encoded, thereby improving video prediction efficiency.

CROSS-REFERENCE TO RELATED PATENT APPLICATION

This is a continuation reissue application of U.S. application Ser. No.14/849,073, which was filed on Sep. 9, 2015, which is a reissueapplication of U.S. Pat. No. 8,548,052, which was filed as U.S. patentapplication Ser. No. 12/964,688 on Dec. 9, 2010 and issued on Oct. 1,2013, which is the subject of four other co-pending reissue applicationsincluding U.S. Ser. No. 14/849,073, filed on Sep. 9, 2015, U.S. Ser. No.14/927,025 filed on Oct. 29, 2015, U.S. Ser. No. 14/926,883 filed onOct. 29, 2015, and U.S. Ser. No. 14/927,096 filed on Oct. 29, 2015, andwhich claims priority from Korean Patent Application No.10-2009-0121935, filed on Dec. 9, 2009 in the Korean IntellectualProperty Office, the disclosure of which is incorporated herein byreference in its entirety by reference.

BACKGROUND

1. Field

One or more exemplary embodiments relate to a video encoding method andapparatus and a video decoding method and apparatus that are capable ofimproving video compression efficiency by performing post-processingaccording to a location of predicted video data.

2. Description of the Related Art

In an image compression method, such as Moving Picture Experts Group(MPEG)-1, MPEG-2, MPEG-4, or H.264/MPEG-4 Advanced Video Coding (AVC), apicture is divided into macroblocks in order to encode an image. Each ofthe macroblocks is encoded in all encoding modes that can be used ininter prediction or intra prediction, and then is encoded in an encodingmode that is selected according to a bitrate used to encode themacroblock and a distortion degree of a decoded macroblock based on theoriginal macroblock. As hardware for reproducing and storing highresolution or high quality video content is being developed andsupplied, a need for a video codec for effectively encoding or decodingthe high resolution or high quality video content is increasing. In arelated art video codec, a video is encoded in units of macroblocks eachhaving a predetermined size.

SUMMARY

One or more exemplary embodiments provide a video encoding method andapparatus and a video decoding method and apparatus for improving videocompression efficiency by generating a new predicted block by changing avalue of each pixel in a predicted block through post-processingaccording to a location of a predicted block in a picture.

According to an aspect of an exemplary embodiment, there is provided amethod of encoding video, the method including: producing a firstpredicted coding unit of a current coding unit that is to be encoded;determining whether the current coding unit includes a portion locatedoutside a boundary of a current picture; and producing a secondpredicted coding unit by changing a value of pixels of the firstpredicted coding unit by using the pixels of the first predicted codingunit and neighboring pixels of the pixels when the current coding unitdoes not include the portion located outside the boundary of the currentpicture, and skipping the producing the second predicted coding unitwhen the current coding unit includes a portion located outside aboundary of the current picture.

According to an aspect of another exemplary embodiment, there isprovided an apparatus for encoding video, the apparatus including: apredictor which produces a first predicted coding unit of a currentcoding unit that is to be encoded; a determiner which determines whetherthe current coding unit includes a portion located outside a boundary ofa current picture; and a post-processor which produces a secondpredicted coding unit by changing values of pixels of the firstpredicted coding unit by using the pixels of the first predicted codingunit and neighboring pixels of the pixels when the current coding unitdoes not include the portion located outside the boundary of the currentpicture, and skipping the producing the second predicted coding unitwhen the current coding unit includes the portion located outside theboundary of the current picture.

According to an aspect of another exemplary embodiment, there isprovided a method of decoding video, the method including: extractinginformation regarding a prediction mode for a current decoding unit,which is to be decoded, from a received bitstream; producing a firstpredicted decoding unit of the current decoding unit, based on theextracted information; determining whether the current decoding unitincludes a portion located outside a boundary of a current picture; andproducing a second predicted decoding unit by changing values of pixelsof the first predicted decoding unit by using the pixels of the firstpredicted decoding unit and neighboring pixels of the pixels when thecurrent decoding unit does not include the portion located outside theboundary of the current picture, and skipping the producing the secondpredicted decoding unit when the current decoding unit includes theportion located outside the boundary of the current picture.

According to an aspect of another exemplary embodiment, there isprovided an apparatus for decoding video, the apparatus including: anentropy decoder which extracts information regarding a prediction modefor a current decoding unit, which is to be decoded, from a receivedbitstream; a predictor which produces a first predicted decoding unit ofthe current decoding unit, based on the extracted information; adeterminer which determines whether the current decoding unit includes aportion located outside a boundary of a current picture; and apost-processor which produces a second predicted decoding unit bychanging a value of pixels of the first predicted decoding unit by usingthe pixels of the first predicted decoding unit and neighboring pixelsof the pixels when the current decoding unit does not include theportion located outside the boundary of the current picture, andskipping the producing the second predicted decoding unit when thecurrent decoding unit includes the portion located outside the boundaryof the current picture.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other features will become more apparent by describing indetail exemplary embodiments thereof with reference to the attacheddrawings in which:

FIG. 1 is a block diagram of an apparatus for encoding a video,according to an exemplary embodiment;

FIG. 2 is a block diagram of an apparatus for decoding a video,according to an exemplary embodiment;

FIG. 3 is a diagram for describing a concept of coding units accordingto an exemplary embodiment;

FIG. 4 is a block diagram of an image encoder based on coding unitsaccording to an exemplary embodiment;

FIG. 5 is a block diagram of an image decoder based on coding unitsaccording to an exemplary embodiment;

FIG. 6 is a diagram illustrating deeper coding units according todepths, and partitions according to an exemplary embodiment;

FIG. 7 is a diagram for describing a relationship between a coding unitand transform units, according to an exemplary embodiment;

FIG. 8 is a diagram for describing encoding information of coding unitscorresponding to a coded depth, according to an exemplary embodiment;

FIG. 9 is a diagram of deeper coding units according to depths,according to an exemplary embodiment;

FIGS. 10 through 12 are diagrams for describing a relationship betweencoding units, prediction units, and transform units, according to anexemplary embodiment;

FIG. 13 is a diagram for describing a relationship between a codingunit, a prediction unit or a partition, and a transform unit, accordingto encoding mode information of Table 1;

FIG. 14 is a block diagram of an intra prediction apparatus according toan exemplary embodiment;

FIG. 15 is a table showing a number of intra prediction modes accordingto the size of a coding unit, according to an exemplary embodiment;

FIGS. 16A to 16C are diagrams for explaining intra prediction modes thatmay be performed on a coding unit having a predetermined size, accordingto exemplary embodiments;

FIG. 17 is a drawing for explaining intra prediction modes that may beperformed on a coding unit having a predetermined size, according toother exemplary embodiments;

FIGS. 18A through 18C are reference diagrams for explaining interprediction modes having various directionalities according to anexemplary embodiment;

FIG. 19 is a reference diagram for explaining a bi-linear mode accordingto an exemplary embodiment;

FIG. 20 is a reference diagram for explaining post-processing of a firstpredicted coding unit, according to an exemplary embodiment;

FIG. 21 is a reference diagram for explaining an operation of apost-processor according to an exemplary embodiment;

FIG. 22 is a reference diagram for explaining neighboring pixels to beused by a post-processor according to an exemplary embodiment;

FIG. 23 is a flowchart illustrating a method of encoding video accordingto an exemplary embodiment;

FIG. 24 is a reference diagram for explaining an indexing process forpost-processing a coding unit according to an exemplary embodiment;

FIG. 25 is a reference diagram for explaining an indexing process forpost-processing a coding unit according to another exemplary embodiment;and

FIG. 26 is a flowchart illustrating a method of decoding video accordingto an exemplary embodiment.

FIG. 27 is a diagram for explaining a relationship between a currentpixel and neighboring pixels located on an extended line having adirectivity of (dx, dy);

FIG. 28 is a diagram for explaining a change in a neighboring pixellocated on an extended line having a directivity of (dx, dy) accordingto a location of a current pixel, according to an exemplary embodiment;and

FIGS. 29 and 30 are diagrams for explaining a method of determining anintra prediction mode direction, according to exemplary embodiments.

DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS

Hereinafter, the exemplary embodiments will be described more fully withreference to the accompanying drawings, in which exemplary embodimentsare shown. In the exemplary embodiments, unit may or may not refer to aunit of size, depending on its context.

A video encoding method and apparatus and a video decoding method andapparatus according to exemplary embodiments will now be described withreference to FIGS. 1 to 13.

Hereinafter, a coding unit is an encoding data unit in which the imagedata is encoded at an encoder side and an encoded data unit in which theencoded image data is decoded at a decoder side, according to exemplaryembodiments. Also, a coded depth indicates a depth where a coding unitis encoded. Furthermore, an image may denote a still image for a videoor a moving image, that is, the video itself.

FIG. 1 is a block diagram of a video encoding apparatus 100, accordingto an exemplary embodiment. The video encoding apparatus 100 includes amaximum coding unit splitter 110, a coding unit determiner 120, and anoutput unit 130.

The maximum coding unit splitter 110 may split a current picture basedon a maximum coding unit for the current picture of an image. If thecurrent picture is larger than the maximum coding unit, image data ofthe current picture may be split into the at least one maximum codingunit. The maximum coding unit according to an exemplary embodiment maybe a data unit having a size of 32×32, 64×64, 128×128, 256×256, etc.,wherein a shape of the data unit is a square having a width and heightin squares of 2. The image data may be output to the coding unitdeterminer 120 according to the at least one maximum coding unit.

A coding unit according to an exemplary embodiment may be characterizedby a maximum size and a depth. The depth denotes a number of times thecoding unit is spatially split from the maximum coding unit, and as thedepth deepens or increases, deeper encoding units according to depthsmay be split from the maximum coding unit to a minimum coding unit. Adepth of the maximum coding unit is an uppermost depth and a depth ofthe minimum coding unit is a lowermost depth. Since a size of a codingunit corresponding to each depth decreases as the depth of the maximumcoding unit deepens, a coding unit corresponding to an upper depth mayinclude a plurality of coding units corresponding to lower depths.

As described above, the image data of the current picture is split intothe maximum coding units according to a maximum size of the coding unit,and each of the maximum coding units may include deeper coding unitsthat are split according to depths. Since the maximum coding unitaccording to an exemplary embodiment is split according to depths, theimage data of a spatial domain included in the maximum coding unit maybe hierarchically classified according to depths.

A maximum depth and a maximum size of a coding unit, which limit thetotal number of times a height and a width of the maximum coding unitare hierarchically split, may be predetermined.

The coding unit determiner 120 encodes at least one split regionobtained by splitting a region of the maximum coding unit according todepths, and determines a depth to output a finally encoded image dataaccording to the at least one split region. In other words, the codingunit determiner 120 determines a coded depth by encoding the image datain the deeper coding units according to depths, according to the maximumcoding unit of the current picture, and selecting a depth having theleast encoding error. Thus, the encoded image data of the coding unitcorresponding to the determined coded depth is finally output. Also, thecoding units corresponding to the coded depth may be regarded as encodedcoding units.

The determined coded depth and the encoded image data according to thedetermined coded depth are output to the output unit 130.

The image data in the maximum coding unit is encoded based on the deepercoding units corresponding to at least one depth equal to or below themaximum depth, and results of encoding the image data are compared basedon each of the deeper coding units. A depth having the least encodingerror may be selected after comparing encoding errors of the deepercoding units. At least one coded depth may be selected for each maximumcoding unit.

The size of the maximum coding unit is split as a coding unit ishierarchically split according to depths, and as the number of codingunits increases. Also, even if coding units correspond to same depth inone maximum coding unit, it is determined whether to split each of thecoding units corresponding to the same depth to a lower depth bymeasuring an encoding error of the image data of the each coding unit,separately. Accordingly, even when image data is included in one maximumcoding unit, the image data is split to regions according to the depthsand the encoding errors may differ according to regions in the onemaximum coding unit, and thus the coded depths may differ according toregions in the image data. Thus, one or more coded depths may bedetermined in one maximum coding unit, and the image data of the maximumcoding unit may be divided according to coding units of at least onecoded depth.

Accordingly, the coding unit determiner 120 may determine coding unitshaving a tree structure included in the maximum coding unit. The codingunits having a tree structure according to an exemplary embodimentinclude coding units corresponding to a depth determined to be the codeddepth, from among all deeper coding units included in the maximum codingunit. A coding unit of a coded depth may be hierarchically determinedaccording to depths in the same region of the maximum coding unit, andmay be independently determined in different regions. Similarly, a codeddepth in a current region may be independently determined from a codeddepth in another region.

A maximum depth according to an exemplary embodiment is an index relatedto the number of splitting times from a maximum coding unit to a minimumcoding unit. A first maximum depth according to an exemplary embodimentmay denote the total number of splitting times from the maximum codingunit to the minimum coding unit. A second maximum depth according to anexemplary embodiment may denote the total number of depth levels fromthe maximum coding unit to the minimum coding unit. For example, when adepth of the maximum coding unit is 0, a depth of a coding unit, inwhich the maximum coding unit is split once, may be set to 1, and adepth of a coding unit, in which the maximum coding unit is split twice,may be set to 2. Here, if the minimum coding unit is a coding unit inwhich the maximum coding unit is split four times, 5 depth levels ofdepths 0, 1, 2, 3 and 4 exist, and thus the first maximum depth may beset to 4, and the second maximum depth may be set to 5.

Prediction encoding and transformation may be performed according to themaximum coding unit. The prediction encoding and the transformation arealso performed based on the deeper coding units according to a depthequal to or depths less than the maximum depth, according to the maximumcoding unit. Transformation may be performed according to method oforthogonal transformation or integer transformation.

Since the number of deeper coding units increases whenever the maximumcoding unit is split according to depths, encoding including theprediction encoding and the transformation is performed on all of thedeeper coding units generated as the depth deepens. For convenience ofdescription, the prediction encoding and the transformation will now bedescribed based on a coding unit of a current depth, in a maximum codingunit.

The video encoding apparatus 100 may variably select a size or shape ofa data unit for encoding the image data. In order to encode the imagedata, operations, such as prediction encoding, transformation, andentropy encoding, are performed, and at this time, the same data unitmay be used for all operations or different data units may be used foreach operation.

For example, the video encoding apparatus 100 may select not only acoding unit for encoding the image data, but also a data unit differentfrom the coding unit so as to perform the prediction encoding on theimage data in the coding unit.

In order to perform prediction encoding in the maximum coding unit, theprediction encoding may be performed based on a coding unitcorresponding to a coded depth, i.e., based on a coding unit that is nolonger split to coding units corresponding to a lower depth.Hereinafter, the coding unit that is no longer split and becomes a basisunit for prediction encoding will now be referred to as a predictionunit. A partition obtained by splitting the prediction unit may includea prediction unit or a data unit obtained by splitting at least one of aheight and a width of the prediction unit.

For example, when a coding unit of 2N×2N (where N is a positive integer)is no longer split and becomes a prediction unit of 2N×2N, and a size ofa partition may be 2N×2N, 2N×N, N×2N, or N×N. Examples of a partitiontype include symmetrical partitions that are obtained by symmetricallysplitting a height or width of the prediction unit, partitions obtainedby asymmetrically splitting the height or width of the prediction unit,such as 1:n or n:1, partitions that are obtained by geometricallysplitting the prediction unit, and partitions having arbitrary shapes.

A prediction mode of the prediction unit may be at least one of an intramode, a inter mode, and a skip mode. For example, the intra mode or theinter mode may be performed on the partition of 2N×2N, 2N×N, N×2N, orN×N. Also, the skip mode may be performed only on the partition of2N×2N. The encoding is independently performed on one prediction unit ina coding unit, thereby selecting a prediction mode having a leastencoding error.

The video encoding apparatus 100 may also perform the transformation onthe image data in a coding unit based not only on the coding unit forencoding the image data, but also based on a data unit that is differentfrom the coding unit.

In order to perform the transformation in the coding unit, thetransformation may be performed based on a data unit having a sizesmaller than or equal to the coding unit. For example, the data unit forthe transformation may include a data unit for an intra mode and a dataunit for an inter mode.

A data unit used as a base of the transformation will now be referred toas a transform unit. A transformation depth indicating the number ofsplitting times to reach the transform unit by splitting the height andwidth of the coding unit may also be set in the transform unit. Forexample, in a current coding unit of 2N×2N, a transformation depth maybe 0 when the size of a transform unit is also 2N×2N, may be 1 when eachof the height and width of the current coding unit is split into twoequal parts, totally split into 4¹ transform units, and the size of thetransform unit is thus N×N, and may be 2 when each of the height andwidth of the current coding unit is split into four equal parts, totallysplit into 4² transform units and the size of the transform unit is thusN/2×N/2. For example, the transform unit may be set according to ahierarchical tree structure, in which a transform unit of an uppertransformation depth is split into four transform units of a lowertransformation depth according to the hierarchical characteristics of atransformation depth.

Similarly to the coding unit, the transform unit in the coding unit maybe recursively split into smaller sized regions, so that the transformunit may be determined independently in units of regions. Thus, residualdata in the coding unit may be divided according to the transformationhaving the tree structure according to transformation depths.

Encoding information according to coding units corresponding to a codeddepth requires not only information about the coded depth, but alsoabout information related to prediction encoding and transformation.Accordingly, the coding unit determiner 120 not only determines a codeddepth having a least encoding error, but also determines a partitiontype in a prediction unit, a prediction mode according to predictionunits, and a size of a transform unit for transformation.

Coding units according to a tree structure in a maximum coding unit anda method of determining a partition, according to exemplary embodiments,will be described in detail later with reference to FIGS. 3 through 12.

The coding unit determiner 120 may measure an encoding error of deepercoding units according to depths by using Rate-Distortion Optimizationbased on Lagrangian multipliers.

The output unit 130 outputs the image data of the maximum coding unit,which is encoded based on the at least one coded depth determined by thecoding unit determiner 120, and information about the encoding modeaccording to the coded depth, in bitstreams.

The encoded image data may be obtained by encoding residual data of animage.

The information about the encoding mode according to coded depth mayinclude information about the coded depth, about the partition type inthe prediction unit, the prediction mode, and the size of the transformunit.

The information about the coded depth may be defined by using splitinformation according to depths, which indicates whether encoding isperformed on coding units of a lower depth instead of a current depth.If the current depth of the current coding unit is the coded depth,image data in the current coding unit is encoded and output, and thusthe split information may be defined not to split the current codingunit to a lower depth. Alternatively, if the current depth of thecurrent coding unit is not the coded depth, the encoding is performed onthe coding unit of the lower depth, and thus the split information maybe defined to split the current coding unit to obtain the coding unitsof the lower depth.

If the current depth is not the coded depth, encoding is performed onthe coding unit that is split into the coding unit of the lower depth.Since at least one coding unit of the lower depth exists in one codingunit of the current depth, the encoding is repeatedly performed on eachcoding unit of the lower depth, and thus the encoding may be recursivelyperformed for the coding units having the same depth.

Since the coding units having a tree structure are determined for onemaximum coding unit, and information about at least one encoding mode isdetermined for a coding unit of a coded depth, information about atleast one encoding mode may be determined for one maximum coding unit.Also, a coded depth of the image data of the maximum coding unit may bedifferent according to locations since the image data is hierarchicallysplit according to depths, and thus information about the coded depthand the encoding mode may be set for the image data.

Accordingly, the output unit 130 may assign encoding information about acorresponding coded depth and an encoding mode to at least one of thecoding unit, the prediction unit, and a minimum unit included in themaximum coding unit.

The minimum unit according to an exemplary embodiment is a rectangulardata unit obtained by splitting the minimum coding unit constituting thelowermost depth by 4. Alternatively, the minimum unit may be a maximumrectangular data unit that may be included in all of the coding units,prediction units, partition units, and transform units included in themaximum coding unit.

For example, the encoding information output through the output unit 130may be classified into encoding information according to coding units,and encoding information according to prediction units. The encodinginformation according to the coding units may include the informationabout the prediction mode and about the size of the partitions. Theencoding information according to the prediction units may includeinformation about an estimated direction of an inter mode, about areference image index of the inter mode, about a motion vector, about achroma component of an intra mode, and about an interpolation method ofthe intra mode. Also, information about a maximum size of the codingunit defined according to pictures, slices, or GOPs, and informationabout a maximum depth may be inserted into SPS (Sequence Parameter Set)or a header of a bitstream.

In the video encoding apparatus 100, the deeper coding unit may be acoding unit obtained by dividing a height or width of a coding unit ofan upper depth, which is one layer above, by two. In other words, whenthe size of the coding unit of the current depth is 2N×2N, the size ofthe coding unit of the lower depth is N×N. Also, the coding unit of thecurrent depth having the size of 2N×2N may include a maximum of 4 codingunits of the lower depth.

Accordingly, the video encoding apparatus 100 may form the coding unitshaving the tree structure by determining coding units having an optimumshape and an optimum size for each maximum coding unit, based on thesize of the maximum coding unit and the maximum depth determinedconsidering characteristics of the current picture. Also, since encodingmay be performed on each maximum coding unit by using any one of variousprediction modes and transformations, an optimum encoding mode may bedetermined considering characteristics of the coding unit of variousimage sizes.

Thus, if an image having high resolution or large data amount is encodedin a related art macroblock, a number of macroblocks per pictureexcessively increases. Accordingly, a number of pieces of compressedinformation generated for each macroblock increases, and thus it isdifficult to transmit the compressed information and data compressionefficiency decreases. However, by using the video encoding apparatus100, image compression efficiency may be increased since a coding unitis adjusted while considering characteristics of an image whileincreasing a maximum size of a coding unit while considering a size ofthe image.

FIG. 2 is a block diagram of a video decoding apparatus 200, accordingto an exemplary embodiment. The video decoding apparatus 200 includes areceiver 210, an image data and encoding information extractor 220, andan image data decoder 230. Definitions of various terms, such as acoding unit, a depth, a prediction unit, a transform unit, andinformation about various encoding modes, for various operations of thevideo decoding apparatus 200 are identical to those described withreference to FIG. 1 and the video encoding apparatus 100.

The receiver 210 receives and parses a bitstream of an encoded video.The image data and encoding information extractor 220 extracts encodedimage data for each coding unit from the parsed bitstream, wherein thecoding units have a tree structure according to each maximum codingunit, and outputs the extracted image data to the image data decoder230. The image data and encoding information extractor 220 may extractinformation about a maximum size of a coding unit of a current picture,from a header about the current picture or SPS.

Also, the image data and encoding information extractor 220 extractsinformation about a coded depth and an encoding mode for the codingunits having a tree structure according to each maximum coding unit,from the parsed bitstream. The extracted information about the codeddepth and the encoding mode is output to the image data decoder 230. Inother words, the image data in a bit stream is split into the maximumcoding unit so that the image data decoder 230 decodes the image datafor each maximum coding unit.

The information about the coded depth and the encoding mode according tothe maximum coding unit may be set for information about at least onecoding unit corresponding to the coded depth, and information about anencoding mode may include information about a partition type of acorresponding coding unit corresponding to the coded depth, about aprediction mode, and a size of a transform unit. Also, splittinginformation according to depths may be extracted as the informationabout the coded depth.

The information about the coded depth and the encoding mode according toeach maximum coding unit extracted by the image data and encodinginformation extractor 220 is information about a coded depth and anencoding mode determined to generate a minimum encoding error when anencoder, such as the video encoding apparatus 100, repeatedly performsencoding for each deeper coding unit according to depths according toeach maximum coding unit. Accordingly, the video decoding apparatus 200may restore an image by decoding the image data according to a codeddepth and an encoding mode that generates the minimum encoding error.

Since encoding information about the coded depth and the encoding modemay be assigned to a predetermined data unit from among a correspondingcoding unit, a prediction unit, and a minimum unit, the image data andencoding information extractor 220 may extract the information about thecoded depth and the encoding mode according to the predetermined dataunits. The predetermined data units to which the same information aboutthe coded depth and the encoding mode is assigned may be inferred to bethe data units included in the same maximum coding unit.

The image data decoder 230 restores the current picture by decoding theimage data in each maximum coding unit based on the information aboutthe coded depth and the encoding mode according to the maximum codingunits. In other words, the image data decoder 230 may decode the encodedimage data based on the extracted information about the partition type,the prediction mode, and the transform unit for each coding unit fromamong the coding units having the tree structure included in eachmaximum coding unit. A decoding process may include a predictionincluding intra prediction and motion compensation, and an inversetransformation. Inverse transformation may be performed according tomethod of inverse orthogonal transformation or inverse integertransformation.

The image data decoder 230 may perform intra prediction or motioncompensation according to a partition and a prediction mode of eachcoding unit, based on the information about the partition type and theprediction mode of the prediction unit of the coding unit according tocoded depths.

Also, the image data decoder 230 may perform inverse transformationaccording to each transform unit in the coding unit, based on theinformation about the size of the transform unit of the coding unitaccording to coded depths, so as to perform the inverse transformationaccording to maximum coding units.

The image data decoder 230 may determine at least one coded depth of acurrent maximum coding unit by using split information according todepths. If the split information indicates that image data is no longersplit in the current depth, the current depth is a coded depth.Accordingly, the image data decoder 230 may decode encoded data of atleast one coding unit corresponding to the each coded depth in thecurrent maximum coding unit by using the information about the partitiontype of the prediction unit, the prediction mode, and the size of thetransform unit for each coding unit corresponding to the coded depth,and output the image data of the current maximum coding unit.

In other words, data units containing the encoding information includingthe same split information may be gathered by observing the encodinginformation set assigned for the predetermined data unit from among thecoding unit, the prediction unit, and the minimum unit, and the gathereddata units may be considered to be one data unit to be decoded by theimage data decoder 230 in the same encoding mode.

The video decoding apparatus 200 may obtain information about at leastone coding unit that generates the minimum encoding error when encodingis recursively performed for each maximum coding unit, and may use theinformation to decode the current picture. In other words, the codingunits having the tree structure determined to be the optimum codingunits in each maximum coding unit may be decoded. Also, the maximum sizeof coding unit is determined considering resolution and an amount ofimage data.

Accordingly, even if image data has high resolution and a large amountof data, the image data may be efficiently decoded and restored by usinga size of a coding unit and an encoding mode, which are adaptivelydetermined according to characteristics of the image data, by usinginformation about an optimum encoding mode received from an encoder.

A method of determining coding units having a tree structure, aprediction unit, and a transform unit, according to an exemplaryembodiment, will now be described with reference to FIGS. 3 through 13.

FIG. 3 is a diagram for describing a concept of coding units accordingto an exemplary embodiment. A size of a coding unit may be expressed inwidth×height, and may be 64×64, 32×32, 16×16, and 8×8. A coding unit of64×64 may be split into partitions of 64×64, 64×32, 32×64, or 32×32, anda coding unit of 32×32 may be split into partitions of 32×32, 32×16,16×32, or 16×16, a coding unit of 16×16 may be split into partitions of16×16, 16×8, 8×16, or 8×8, and a coding unit of 8×8 may be split intopartitions of 8×8, 8×4, 4×8, or 4×4.

In video data 310, a resolution is 1920×1080, a maximum size of a codingunit is 64, and a maximum depth is 2. In video data 320, a resolution is1920×1080, a maximum size of a coding unit is 64, and a maximum depth is3. In video data 330, a resolution is 352×288, a maximum size of acoding unit is 16, and a maximum depth is 1. The maximum depth shown inFIG. 3 denotes a total number of splits from a maximum coding unit to aminimum decoding unit.

If a resolution is high or a data amount is large, a maximum size of acoding unit may be large so as to not only increase encoding efficiencybut also to accurately reflect characteristics of an image. Accordingly,the maximum size of the coding unit of the video data 310 and 320 havingthe higher resolution than the video data 330 may be 64.

Since the maximum depth of the video data 310 is 2, coding units 315 ofthe video data 310 may include a maximum coding unit having a long axissize of 64, and coding units having long axis sizes of 32 and 16 sincedepths are deepened to two layers by splitting the maximum coding unittwice. Meanwhile, since the maximum depth of the video data 330 is 1,coding units 335 of the video data 330 may include a maximum coding unithaving a long axis size of 16, and coding units having a long axis sizeof 8 since depths are deepened to one layer by splitting the maximumcoding unit once.

Since the maximum depth of the video data 320 is 3, coding units 325 ofthe video data 320 may include a maximum coding unit having a long axissize of 64, and coding units having long axis sizes of 32, 16, and 8since the depths are deepened to 3 layers by splitting the maximumcoding unit three times. As a depth deepens, detailed information may beprecisely expressed.

FIG. 4 is a block diagram of an image encoder 400 based on coding units,according to an exemplary embodiment. The image encoder 400 performsoperations of the coding unit determiner 120 of the video encodingapparatus 100 to encode image data. In other words, an intra predictor410 performs intra prediction on coding units in an intra mode, fromamong a current frame 405, and a motion estimator 420 and a motioncompensator 425 performs inter estimation and motion compensation oncoding units in an inter mode from among the current frame 405 by usingthe current frame 405, and a reference frame 495.

Data output from the intra predictor 410, the motion estimator 420, andthe motion compensator 425 is output as a quantized transformationcoefficient through a transformer 430 and a quantizer 440. The quantizedtransformation coefficient is restored as data in a spatial domainthrough an inverse quantizer 460 and an inverse transformer 470, and therestored data in the spatial domain is output as the reference frame 495after being post-processed through a deblocking unit 480 and a loopfiltering unit 490. The quantized transformation coefficient may beoutput as a bitstream 455 through an entropy encoder 450.

In order for the image encoder 400 to be applied in the video encodingapparatus 100, all elements of the image encoder 400, i.e., the intrapredictor 410, the motion estimator 420, the motion compensator 425, thetransformer 430, the quantizer 440, the entropy encoder 450, the inversequantizer 460, the inverse transformer 470, the deblocking unit 480, andthe loop filtering unit 490 perform operations based on each coding unitfrom among coding units having a tree structure while considering themaximum depth of each maximum coding unit.

Specifically, the intra predictor 410, the motion estimator 420, and themotion compensator 425 determines partitions and a prediction mode ofeach coding unit from among the coding units having a tree structurewhile considering the maximum size and the maximum depth of a currentmaximum coding unit, and the transformer 430 determines the size of thetransform unit in each coding unit from among the coding units having atree structure.

FIG. 5 is a block diagram of an image decoder 500 based on coding units,according to an exemplary embodiment. A parser 510 parses encoded imagedata to be decoded and information about encoding required for decodingfrom a bitstream 505. The encoded image data is output as inversequantized data through an entropy decoder 520 and an inverse quantizer530, and the inverse quantized data is restored to image data in aspatial domain through an inverse transformer 540.

An intra predictor 550 performs intra prediction on coding units in anintra mode with respect to the image data in the spatial domain, and amotion compensator 560 performs motion compensation on coding units inan inter mode by using a reference frame 585.

The image data in the spatial domain, which passed through the intrapredictor 550 and the motion compensator 560, may be output as arestored frame 595 after being post-processed through a deblocking unit570 and a loop filtering unit 580. Also, the image data that ispost-processed through the deblocking unit 570 and the loop filteringunit 580 may be output as the reference frame 585.

In order to decode the image data in the image data decoder 230 of thevideo decoding apparatus 200, the image decoder 500 may performoperations that are performed after the parser 510.

In order for the image decoder 500 to be applied in the video decodingapparatus 200, all elements of the image decoder 500, i.e., the parser510, the entropy decoder 520, the inverse quantizer 530, the inversetransformer 540, the intra predictor 550, the motion compensator 560,the deblocking unit 570, and the loop filtering unit 580 performoperations based on coding units having a tree structure for eachmaximum coding unit.

Specifically, the intra predictor 550 and the motion compensator 560perform operations based on partitions and a prediction mode for each ofthe coding units having a tree structure, and the inverse transformer540 perform operations based on a size of a transform unit for eachcoding unit.

FIG. 6 is a diagram illustrating deeper coding units according todepths, and partitions, according to an exemplary embodiment. The videoencoding apparatus 100 and the video decoding apparatus 200 usehierarchical coding units so as to consider characteristics of an image.A maximum height, a maximum width, and a maximum depth of coding unitsmay be adaptively determined according to the characteristics of theimage, or may be differently set by a user. Sizes of deeper coding unitsaccording to depths may be determined according to the predeterminedmaximum size of the coding unit.

In a hierarchical structure 600 of coding units, according to anexemplary embodiment, the maximum height and the maximum width of thecoding units are each 64, and the maximum depth is 4. Since a depthdeepens along a vertical axis of the hierarchical structure 600, aheight and a width of the deeper coding unit are each split. Also, aprediction unit and partitions, which are bases for prediction encodingof each deeper coding unit, are shown along a horizontal axis of thehierarchical structure 600.

In other words, a coding unit 610 is a maximum coding unit in thehierarchical structure 600, wherein a depth is 0 and a size, i.e., aheight by width, is 64×64. The depth deepens along the vertical axis,and a coding unit 620 having a size of 32×32 and a depth of 1, a codingunit 630 having a size of 16×16 and a depth of 2, a coding unit 640having a size of 8×8 and a depth of 3, and a coding unit 650 having asize of 4×4 and a depth of 4 exist. The coding unit 650 having the sizeof 4×4 and the depth of 4 is a minimum coding unit.

The prediction unit and the partitions of a coding unit are arrangedalong the horizontal axis according to each depth. In other words, ifthe coding unit 610 having the size of 64×64 and the depth of 0 is aprediction unit, the prediction unit may be split into partitionsinclude in the encoding unit 610, i.e. a partition 610 having a size of64×64, partitions 612 having the size of 64×32, partitions 614 havingthe size of 32×64, or partitions 616 having the size of 32×32.

Similarly, a prediction unit of the coding unit 620 having the size of32×32 and the depth of 1 may be split into partitions included in thecoding unit 620, i.e., a partition 620 having a size of 32×32,partitions 622 having a size of 32×16, partitions 624 having a size of16×32, and partitions 626 having a size of 16×16.

Similarly, a prediction unit of the coding unit 630 having the size of16×16 and the depth of 2 may be split into partitions included in thecoding unit 630, i.e. a partition having a size of 16×16 included in thecoding unit 630, partitions 632 having a size of 16×8, partitions 634having a size of 8×16, and partitions 636 having a size of 8×8.

Similarly, a prediction unit of the coding unit 640 having the size of8×8 and the depth of 3 may be split into partitions included in thecoding unit 640, i.e. a partition having a size of 8×8 included in thecoding unit 640, partitions 642 having a size of 8×4, partitions 644having a size of 4×8, and partitions 646 having a size of 4×4.

The coding unit 650 having the size of 4×4 and the depth of 4 is theminimum coding unit and a coding unit of the lowermost depth. Aprediction unit of the coding unit 650 is only assigned to a partitionhaving a size of 4×4.

In order to determine the at least one coded depth of the coding unitsconstituting the maximum coding unit 610, the coding unit determiner 120of the video encoding apparatus 100 performs encoding for coding unitscorresponding to each depth included in the maximum coding unit 610.

A number of deeper coding units according to depths including data inthe same range and the same size increases as the depth deepens. Forexample, four coding units corresponding to a depth of 2 are required tocover data that is included in one coding unit corresponding to a depthof 1. Accordingly, in order to compare encoding results of the same dataaccording to depths, the coding unit corresponding to the depth of 1 andfour coding units corresponding to the depth of 2 are each encoded.

In order to perform encoding for a current depth from among the depths,a least encoding error may be selected for the current depth byperforming encoding for each prediction unit in the coding unitscorresponding to the current depth, along the horizontal axis of thehierarchical structure 600. Alternatively, the minimum encoding errormay be searched for by comparing the least encoding errors according todepths, by performing encoding for each depth as the depth deepens alongthe vertical axis of the hierarchical structure 600. A depth and apartition having the minimum encoding error in the coding unit 610 maybe selected as the coded depth and a partition type of the coding unit610.

FIG. 7 is a diagram for describing a relationship between a coding unit710 and transform units 720, according to an exemplary embodiment.

The video encoding apparatus 100 or 200 encodes or decodes an imageaccording to coding units having sizes smaller than or equal to amaximum coding unit for each maximum coding unit. Sizes of transformunits for transformation during encoding may be selected based on dataunits that are not larger than a corresponding coding unit.

For example, in the video encoding apparatus 100 or 200, if a size ofthe coding unit 710 is 64×64, transformation may be performed by usingthe transform units 720 having a size of 32×32.

Also, data of the coding unit 710 having the size of 64×64 may beencoded by performing the transformation on each of the transform unitshaving the size of 32×32, 16×16, 8×8, and 4×4, which are smaller than64×64, and then a transform unit having the least coding error may beselected.

FIG. 8 is a diagram for describing encoding information of coding unitscorresponding to a coded depth, according to an exemplary embodiment.The output unit 130 of the video encoding apparatus 100 may encode andtransmit information 800 about a partition type, information 810 about aprediction mode, and information 820 about a size of a transform unitfor each coding unit corresponding to a coded depth, as informationabout an encoding mode.

The information 800 indicates information about a shape of a partitionobtained by splitting a prediction unit of a current coding unit,wherein the partition is a data unit for prediction encoding the currentcoding unit. For example, a current coding unit CU_0 having a size of2N×2N may be split into any one of a partition 802 having a size of2N×2N, a partition 804 having a size of 2N×N, a partition 806 having asize of N×2N, and a partition 808 having a size of N×N. Here, theinformation 800 about a partition type is set to indicate one of thepartition 804 having a size of 2N×N, the partition 806 having a size ofN×2N, and the partition 808 having a size of N×N

The information 810 indicates a prediction mode of each partition. Forexample, the information 810 may indicate a mode of prediction encodingperformed on a partition indicated by the information 800, i.e., anintra mode 812, an inter mode 814, or a skip mode 816.

The information 820 indicates a transform unit to be based on whentransformation is performed on a current coding unit. For example, thetransform unit may be a first intra transform unit 822, a second intratransform unit 824, a first inter transform unit 826, or a second intratransform unit 828.

The image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract and use the information 800, 810, and820 for decoding, according to each deeper coding unit.

FIG. 9 is a diagram of deeper coding units according to depths,according to an exemplary embodiment. Split information may be used toindicate a change of a depth. The spilt information indicates whether acoding unit of a current depth is split into coding units of a lowerdepth.

A prediction unit 910 for prediction encoding a coding unit 900 having adepth of 0 and a size of 2N_0×2N_0 may include partitions of a partitiontype 912 having a size of 2N_0×2N_0, a partition type 914 having a sizeof 2N_0×N_0, a partition type 916 having a size of N_0×2N_0, and apartition type 918 having a size of N_0×N_0. FIG. 9 only illustrates thepartition types 912 through 918 which are obtained by symmetricallysplitting the prediction unit 910, but a partition type is not limitedthereto, and the partitions of the prediction unit 910 may includeasymmetrical partitions, partitions having a predetermined shape, andpartitions having a geometrical shape.

Prediction encoding is repeatedly performed on one partition having asize of 2N_0×2N 0, two partitions having a size of 2N_0×N_0, twopartitions having a size of N_0×2N_0, and four partitions having a sizeof N_0×N_0, according to each partition type. The prediction encoding inan intra mode and an inter mode may be performed on the partitionshaving the sizes of 2N_0×2N_0, N_0×2N_0, 2N_0×N_0, and N_0×N_0. Theprediction encoding in a skip mode is performed only on the partitionhaving the size of 2N_0x2N_0.

Errors of encoding including the prediction encoding in the partitiontypes 912 through 918 are compared, and the least encoding error isdetermined among the partition types. If an encoding error is smallestin one of the partition types 912 through 916, the prediction unit 910may not be split into a lower depth.

If the encoding error is the smallest in the partition type 918, a depthis changed from 0 to 1 to split the partition type 918 in operation 920,and encoding is repeatedly performed on coding units 930 having a depthof 2 and a size of N_0×N_0 to search for a minimum encoding error.

A prediction unit 940 for prediction encoding the coding unit 930 havinga depth of 1 and a size of 2N_1×2N_1(=N_0×N_0) may include partitions ofa partition type 942 having a size of 2N_1×2N_1, a partition type 944having a size of 2N_1×N_1, a partition type 946 having a size ofN_1×2N_1, and a partition type 948 having a size of N_1×N_1.

If an encoding error is the smallest in the partition type 948, a depthis changed from 1 to 2 to split the partition type 948 in operation 950,and encoding is repeatedly performed on coding units 960, which have adepth of 2 and a size of N_2×N_2 to search for a minimum encoding error.

When a maximum depth is d, split operation according to each depth maybe performed up to when a depth becomes d−1, and split information maybe encoded as up to when a depth is one of 0 to d−2. In other words,when encoding is performed up to when the depth is d−1 after a codingunit corresponding to a depth of d−2 is split in operation 970, aprediction unit 990 for prediction encoding a coding unit 980 having adepth of d−1 and a size of 2N_(d−1)×2N_(d−1) may include partitions of apartition type 992 having a size of 2N_(d−1)×2N_(d−1), a partition type994 having a size of 2N_(d−1)×N_(d−1), a partition type 996 having asize of N_(d−1)×2N_(d−1), and a partition type 998 having a size ofN_(d−1)×N_(d−1).

Prediction encoding may be repeatedly performed on one partition havinga size of 2N_(d−1)×2N_(d−1), two partitions having a size of2N_(d−1)×N_(d−1), two partitions having a size of N_(d−1)×2N_(d−1), fourpartitions having a size of N_(d−1)×N_(d−1) from among the partitiontypes 992 through 998 to search for a partition type having a minimumencoding error.

Even when the partition type 998 has the minimum encoding error, since amaximum depth is d, a coding unit CU_(d−1) having a depth of d−1 is nolonger split to a lower depth, and a coded depth for the coding unitsconstituting a current maximum coding unit 900 is determined to be d−1and a partition type of the current maximum coding unit 900 may bedetermined to be N_(d−1)×N_(d−1). Also, since the maximum depth is d anda minimum coding unit 980 having a lowermost depth of d−1 is no longersplit to a lower depth, split information for the minimum coding unit980 is not set.

A data unit 999 may be a minimum unit for the current maximum codingunit. A minimum unit according to an exemplary embodiment may be arectangular data unit obtained by splitting a minimum coding unit 980 by4. By performing the encoding repeatedly, the video encoding apparatus100 may select a depth having the least encoding error by comparingencoding errors according to depths of the coding unit 900 to determinea coded depth, and set a corresponding partition type and a predictionmode as an encoding mode of the coded depth.

As such, the minimum encoding errors according to depths are compared inall of the depths of 1 through d, and a depth having the least encodingerror may be determined as a coded depth. The coded depth, the partitiontype of the prediction unit, and the prediction mode may be encoded andtransmitted as information about an encoding mode. Also, since a codingunit is split from a depth of 0 to a coded depth, only split informationof the coded depth is set to 0, and split information of depthsexcluding the coded depth is set to 1.

The image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract and use the information about thecoded depth and the prediction unit of the coding unit 900 to decode thepartition 912. The video decoding apparatus 200 may determine a depth,in which split information is 0, as a coded depth by using splitinformation according to depths, and use information about an encodingmode of the corresponding depth for decoding.

FIGS. 10 through 12 are diagrams for describing a relationship betweencoding units 1010, prediction units 1060, and transform units 1070,according to an exemplary embodiment. The coding units 1010 are codingunits having a tree structure, corresponding to coded depths determinedby the video encoding apparatus 100, in a maximum coding unit. Theprediction units 1060 are partitions of prediction units of each of thecoding units 1010, and the transform units 1070 are transform units ofeach of the coding units 1010.

When a depth of a maximum coding unit is 0 in the coding units 1010,depths of coding units 1012 and 1054 are 1, depths of coding units 1014,1016, 1018, 1028, 1050, and 1052 are 2, depths of coding units 1020,1022, 1024, 1026, 1030, 1032, and 1048 are 3, and depths of coding units1040, 1042, 1044, and 1046 are 4.

In the prediction units 1060, some encoding units 1014, 1016, 1022,1032, 1048, 1050, 1052, and 1054 are obtained by splitting the codingunits in the encoding units 1010. In other words, partition types in thecoding units 1014, 1022, 1050, and 1054 have a size of 2N×N, partitiontypes in the coding units 1016, 1048, and 1052 have a size of N×2N, anda partition type of the coding unit 1032 has a size of N×N. Predictionunits and partitions of the coding units 1010 are smaller than or equalto each coding unit.

Transformation or inverse transformation is performed on image data ofthe coding unit 1052 in the transform units 1070 in a data unit that issmaller than the coding unit 1052. Also, the coding units 1014, 1016,1022, 1032, 1048, 1050, and 1052 in the transform units 1070 aredifferent from those in the prediction units 1060 in terms of sizes andshapes. In other words, the video encoding and decoding apparatuses 100and 200 may perform intra prediction, motion estimation, motioncompensation, transformation, and inverse transformation individually ona data unit in the same coding unit.

Accordingly, encoding is recursively performed on each of coding unitshaving a hierarchical structure in each region of a maximum coding unitto determine an optimum coding unit, and thus coding units having arecursive tree structure may be obtained. Encoding information mayinclude split information about a coding unit, information about apartition type, information about a prediction mode, and informationabout a size of a transform unit. Table 1 shows the encoding informationthat may be set by the video encoding and decoding apparatuses 100 and200.

TABLE 1 Split Information 0 (Encoding on Coding Unit having Size of 2N ×2N and Current Depth of d) Split Information 1 Prediction Mode PartitionType Size of Transform Unit Repeatedly Intra Symmetrical AsymmetricalSplit Information 0 Split Information 1 Encode Inter Partition Partitionof Transformation of Transformation Coding Skip (Only Type Type UnitUnit Units 2N × 2N) 2N × 2N 2N × nU 2N × 2N N × N having 2N × N 2N × nD(Symmetrical Lower N × 2N nL × 2N Type) Depth of N × N nR × 2N N/2 × N/2d + 1 (Asymmetrical Type)

The output unit 130 of the video encoding apparatus 100 may output theencoding information about the coding units having a tree structure, andthe image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract the encoding information about thecoding units having a tree structure from a received bitstream.

Split information indicates whether a current coding unit is split intocoding units of a lower depth. If split information of a current depth dis 0, a depth, in which a current coding unit is no longer split into alower depth, is a coded depth, and thus information about a partitiontype, prediction mode, and a size of a transform unit may be defined forthe coded depth. If the current coding unit is further split accordingto the split information, encoding is independently performed on foursplit coding units of a lower depth.

A prediction mode may be one of an intra mode, an inter mode, and a skipmode. The intra mode and the inter mode may be defined in all partitiontypes, and the skip mode is defined only in a partition type having asize of 2N×2N.

The information about the partition type may indicate symmetricalpartition types having sizes of 2N×2N, 2N×N, N×2N, and N×N, which areobtained by symmetrically splitting a height or a width of a predictionunit, and asymmetrical partition types having sizes of 2N×nU, 2N×nD,nL×2N, and nR×2N, which are obtained by asymmetrically splitting theheight or width of the prediction unit. The asymmetrical partition typeshaving the sizes of 2N×nU and 2N×nD may be respectively obtained bysplitting the height of the prediction unit in 1:3 and 3:1, and theasymmetrical partition types having the sizes of nL×2N and nR×2N may berespectively obtained by splitting the width of the prediction unit in1:3 and 3:1

The size of the transform unit may be set to be two types in the intramode and two types in the inter mode. In other words, if splitinformation of the transform unit is 0, the size of the transform unitmay be 2N×2N, which is the size of the current coding unit. If splitinformation of the transform unit is 1, the transform units may beobtained by splitting the current coding unit. Also, if a partition typeof the current coding unit having the size of 2N×2N is a symmetricalpartition type, a size of a transform unit may be N×N, and if thepartition type of the current coding unit is an asymmetrical partitiontype, the size of the transform unit may be N/2×N/2.

The encoding information about coding units having a tree structure mayinclude at least one of a coding unit corresponding to a coded depth, aprediction unit, and a minimum unit. The coding unit corresponding tothe coded depth may include at least one of a prediction unit and aminimum unit containing the same encoding information.

Accordingly, it is determined whether adjacent data units are includedin the same coding unit corresponding to the coded depth by comparingencoding information of the adjacent data units. Also, a correspondingcoding unit corresponding to a coded depth is determined by usingencoding information of a data unit, and thus a distribution of codeddepths in a maximum coding unit may be determined.

Accordingly, if a current coding unit is predicted based on encodinginformation of adjacent data units, encoding information of data unitsin deeper coding units adjacent to the current coding unit may bedirectly referred to and used.

Alternatively, if a current coding unit is predicted based on encodinginformation of adjacent data units, data units adjacent to the currentcoding unit are searched using encoding information of the data units,and the searched adjacent coding units may be referred for predictingthe current coding unit.

FIG. 13 is a diagram for describing a relationship between a codingunit, a prediction unit or a partition, and a transform unit, accordingto encoding mode information of Table 1. A maximum coding unit 1300includes coding units 1302, 1304, 1306, 1312, 1314, 1316, and 1318 ofcoded depths. Here, since the coding unit 1318 is a coding unit of acoded depth, split information may be set to 0. Information about apartition type of the coding unit 1318 having a size of 2N×2N may be setto be one of a partition type 1322 having a size of 2N×2N, a partitiontype 1324 having a size of 2N×N, a partition type 1326 having a size ofN×2N, a partition type 1328 having a size of N×N, a partition type 1332having a size of 2N×nU, a partition type 1334 having a size of 2N×nD, apartition type 1336 having a size of nL×2N, and a partition type 1338having a size of nR×2N.

When the partition type is set to be symmetrical, i.e. the partitiontype 1322, 1324, 1326, or 1328, a transform unit 1342 having a size of2N×2N is set if split information (TU size flag) of a transform unit is0, and a transform unit 1344 having a size of N×N is set if a TU sizeflag is 1.

When the partition type is set to be asymmetrical, i.e., the partitiontype 1332, 1334, 1336, or 1338, a transform unit 1352 having a size of2N×2N is set if a TU size flag is 0, and a transform unit 1354 having asize of N/2×N/2 is set if a TU size flag is 1.

Referring to FIG. 13, the TU size flag is a flag having a value or 0 or1, but the TU size flag is not limited to 1 bit, and a transform unitmay be hierarchically split having a tree structure while the TU sizeflag increases from 0.

In this case, the size of a transform unit that has been actually usedmay be expressed by using a TU size flag of a transform unit, accordingto an exemplary embodiment, together with a maximum size and minimumsize of the transform unit. According to an exemplary embodiment, thevideo encoding apparatus 100 is capable of encoding maximum transformunit size information, minimum transform unit size information, and amaximum TU size flag. The result of encoding the maximum transform unitsize information, the minimum transform unit size information, and themaximum TU size flag may be inserted into an SPS. According to anexemplary embodiment, the video decoding apparatus 200 may decode videoby using the maximum transform unit size information, the minimumtransform unit size information, and the maximum TU size flag.

For example, if the size of a current coding unit is 64×64 and a maximumtransform unit size is 32×32, then the size of a transform unit may be32×32 when a TU size flag is 0, may be 16×16 when the TU size flag is 1,and may be 8×8 when the TU size flag is 2.

As another example, if the size of the current coding unit is 32×32 anda minimum transform unit size is 32×32, then the size of the transformunit may be 32×32 when the TU size flag is 0. Here, the TU size flagcannot be set to a value other than 0, since the size of the transformunit cannot be less than 32×32.

As another example, if the size of the current coding unit is 64×64 anda maximum TU size flag is 1, then the TU size flag may be 0 or 1. Here,the TU size flag cannot be set to a value other than 0 or 1.

Thus, if it is defined that the maximum TU size flag isMaxTransformSizeIndex, a minimum transform unit size isMinTransformSize, and a transform unit size is RootTuSize when the TUsize flag is 0, then a current minimum transform unit size CurrMinTuSizethat can be determined in a current coding unit, may be defined byEquation (1):CurrMinTuSize=max(MinTransformSize,RootTuSize/(2{circumflex over( )}MaxTransformSizeIndex))   (1)

Compared to the current minimum transform unit size CurrMinTuSize thatcan be determined in the current coding unit, a transform unit sizeRootTuSize when the TU size flag is 0 may denote a maximum transformunit size that can be selected in the system. In Equation (1),RootTuSize/(2{circumflex over ( )}MaxTransformSizeIndex) denotes atransform unit size when the transform unit size RootTuSize, when the TUsize flag is 0, is split a number of times corresponding to the maximumTU size flag, and MinTransformSize denotes a minimum transformationsize. Thus, a smaller value from among RootTuSize/(2{circumflex over( )}MaxTransformSizeIndex) and MinTransformSize may be the currentminimum transform unit size CurrMinTuSize that can be determined in thecurrent coding unit.

According to an exemplary embodiment, the maximum transform unit sizeRootTuSize may vary according to the type of a prediction mode.

For example, if a current prediction mode is an inter mode, thenRootTuSize may be determined by using Equation (2) below. In Equation(2), MaxTransformSize denotes a maximum transform unit size, and PUSizedenotes a current prediction unit size.RootTuSize=min(MaxTransformSize,PUSize)   (2)

That is, if the current prediction mode is the inter mode, the transformunit size RootTuSize when the TU size flag is 0, may be a smaller valuefrom among the maximum transform unit size and the current predictionunit size.

If a prediction mode of a current partition unit is an intra mode,RootTuSize may be determined by using Equation (3) below. In Equation(3), PartitionSize denotes the size of the current partition unit.RootTuSize=min(MaxTransformSize,PartitionSize)   (3)

That is, if the current prediction mode is the intra mode, the transformunit size RootTuSize when the TU size flag is 0 may be a smaller valuefrom among the maximum transform unit size and the size of the currentpartition unit.

However, the current maximum transform unit size RootTuSize that variesaccording to the type of a prediction mode in a partition unit is justan example and is not limited thereto.

Intra prediction performed by the intra predictor 410 of the imageencoder 400 illustrated in FIG. 4 and the intra predictor 550 of theimage decoder 500 illustrated in FIG. 5 according to one or moreexemplary embodiments, will now be described in detail. In the followingdescription, an encoding unit denotes a current encoded block in anencoding process of an image, and a decoding unit denotes a currentdecoded block in a decoding process of an image. The encoding unit andthe decoding unit are different in that the encoding unit is used in theencoding process and the decoding unit is used in the decoding. For theconsistency of terms, except for a particular case, the encoding unitand the decoding unit may be referred to as a coding unit in both theencoding and decoding processes. Also, one of ordinary skill in the artwould understand by the present specification that an intra predictionmethod and apparatus according to an exemplary embodiment may also beapplied to perform intra prediction in a general video codec.

FIG. 14 is a block diagram of an intra prediction apparatus 1400according to an exemplary embodiment. Referring to FIG. 14, the intraprediction apparatus 1400 includes a predictor 1410, a determiner 1415,and a post-processor 1420. The predictor 1410 intra predicts a currentcoding unit by using intra prediction modes determined according to thesize of the current coding unit, and outputs a first predicted codingunit. The determiner 1415 determines whether the current coding unit hasa portion located outside a boundary of a current picture, and producesan index MPI_PredMode according to the determination result.

The index MPI_PredMode indicates whether what kind of Multi-ParameterIntra-prediction (MPI), which will be described in detail later, is tobe performed. Referring to Table 2, if the index MPI_PredMode is 0, itindicates that the MPI is not performed to produce a second predictedcoding unit, and if the index MPI_PredMode is greater than 0, itindicates that the MPI is to be performed so as to produce the secondpredicted coding unit.

TABLE 2 MPI_PredMode MPI Mode Name Meaning 0 MPI_Mode0 Do not performMPI 1 MPI_Mode1 Perform MPI . . . . . . . . . MPI_PredModelMAXMPI_ModelMAX Perform MPI

According to Table 2, the index MPI_PredMode is 0 or 1 depending onwhether the MPI is to be performed. However, in a case where N modes arepresent as MPI modes, the MPI_PredMode may have integral value rangingfrom 0 to N so as to express the case where the MPI will not beperformed and the N modes.

If the determiner 1415 determines that the current coding unit does notinclude any portion located outside a boundary of the picture, that is,when the index MPI_PredMode is not 0, then the post-processor 1420produces the second predicted coding unit by perform the MPI by usingneighboring pixels of pixels that constitute the first predicted codingunit so as to change the pixel values of the pixels of the firstpredicted coding unit.

FIG. 15 is a table showing a number of intra prediction modes accordingto the size of a coding unit, according to an exemplary embodiment.According to an exemplary embodiment, a number of intra prediction modesmay be determined according to the size of a coding unit (a decodingunit in the case of a decoding process). Referring to FIG. 15, if thesize of a coding unit that is to be intra predicted is, for example,N×N, then numbers of intra prediction modes that are to be actuallyperformed on prediction units having sizes of NMin×NMin, . . . ,NMax×NMax (NMin can be 2 and NMax can be 128) may be depend onprediction unit size. In Example 2 prediction unit sizes are 4×4, 8×8,16×16, 32×32, 64×64 and 128×128. The number of intra prediction modes inthis example are 5, 9, 9, 17, 33, 5, and 5, respectively. For anotherexample, when a size of a coding unit to be intra-predicted is N×N,numbers of intra prediction modes to be actually performed on codingunits having sizes of 2×2, 4×4, 8×8, 16×16, 32×32, 64×64, and 128×128may be set to be 3, 17, 34, 34, 34, 5, and 5. A reason why a number ofintra prediction modes that are to be actually performed is determinedaccording to the size of a coding unit, is because overhead for encodingprediction mode information varies according to the size of the codingunit. In other words, although a small-sized coding unit occupies asmall area in an entire image, overhead for transmitting additionalinformation, e.g., a prediction mode, regarding the small-sized codingunit may be large. Thus, when a small-sized coding unit is encoded usingtoo many prediction modes, a number of bits may increase, thus degradingcompression efficiency. A large-sized coding unit, e.g., a coding unithaving a size of 64×64 or more, is highly likely to be selected as acoding unit for a flat region of an image. Compression efficiency mayalso be degraded when a large-sized coding unit selected to encode sucha flat region is encoded using too many prediction modes.

Thus, according to an exemplary embodiment, coding unit size may belargely classified into at least three sizes: N1×N1 (2≤N1≤4, N1 denotesan integer), N2×N2 (8≤N2≤32, N2 denotes an integer), and N3×N3 (64≤N3,N3 denotes an integer). If a number of intra prediction modes that areto be performed on each coding unit having a size of N1×N1 is A1 (A1denotes a positive integer), a number of intra prediction modes that areto be performed on each coding unit having a size of N2×N2 is A2 (A2denotes a positive integer), and a number of intra prediction modes thatare to be performed on each coding unit having a size of N3×N3 is A3 (A3denotes a positive integer), then a number of intra prediction modesthat are to be performed according to the size of a coding unit, may bedetermined to satisfy A3≤A1≤A2. That is, if a current picture is dividedinto a small-sized coding unit, a medium-sized coding unit, and alarge-sized coding unit, then a number of prediction modes that are tobe performed on the medium-sized coding unit may be greater than thoseof prediction modes to be performed on the small-sized coding unit andthe large-sized coding unit. However, another exemplary embodiment isnot limited thereto and a large number of prediction modes may also beset to be performed on the small-sized and medium-sized coding units.The numbers of prediction modes according to the size of each codingunit illustrated in FIG. 15 are just an example and may thus bevariable.

FIGS. 16A to 16C are drawings for explaining intra prediction modes thatmay be performed on a coding unit having a predetermined size, accordingto exemplary embodiments. FIG. 16A is a table showing intra predictionmodes that may be performed on a coding unit having a predeterminedsize, according to an exemplary embodiment. Referring to FIGS. 15 and16A, for example, if a coding unit having a size of 4×4 is intrapredicted, a vertical mode (mode 0), a horizontal mode (mode 1), adirect-current (DC) mode (mode 2), a diagonal down-left mode (mode 3), adiagonal down-right mode (mode 4), a vertical-right mode (mode 5), ahorizontal-down mode (mode 6), a vertical-left mode (mode 7), or ahorizontal-up mode (mode 8) may be performed.

FIG. 16B illustrate directions of the intra prediction modes illustratedin FIG. 16A, according to an exemplary embodiment. In FIG. 16B, valuesassigned to arrows denote mode values when prediction is performed indirections indicated with the arrows, respectively. Here, mode 2 is a DCprediction mode having no direction and is thus not illustrated in FIG.16B.

FIG. 16C illustrate intra prediction methods that may be performed onthe coding unit illustrated in FIG. 16A, according to an exemplaryembodiment. Referring to FIG. 16C, a predicted coding unit is producedusing neighboring pixels A to M of a current coding unit according to anavailable intra prediction mode determined according to the size of thecurrent coding unit. For example, a method of prediction encoding acurrent coding unit having a size of 4×4 according to the vertical mode(mode 0) of FIG. 16A, will be described. First, pixel values of thepixels A to D adjacent to the top of the 4×4 coding unit are predictedas pixel values of the 4×4 coding unit. Specifically, the pixel valuesof the pixel A are predicted as four pixel values of pixels at a firstcolumn of the 4×4 coding unit, the pixel values of the pixel B arepredicted as four pixel values of pixels at a second column of the 4×4coding unit, the pixel values of the pixel C are predicted as four pixelvalues of pixels at a third column of the 4×4 coding unit, and the pixelvalues of the pixel D are predicted as four pixel values of pixels at afourth column of the 4×4 current coding unit. Then, error values betweenactual pixel values of pixels included in a predicted 4×4 coding unitpredicted using the pixels A to D and the original 4×4 coding unit arecalculated and encoded.

FIG. 17 is drawings for explaining intra prediction modes that may beperformed on a coding unit having a predetermined size, according toother exemplary embodiments. Referring to FIGS. 15 and 17, for example,if a coding unit having a size of 2×2 is intra predicted, a total offive modes, e.g., a vertical mode, a horizontal mode, a DC mode, a planemode, and a diagonal down-right mode, may be performed.

As illustrated in FIG. 15, if a coding unit having a size of 32×32 has33 intra prediction modes, then directions of the 33 intra predictionmodes should be set. According to an exemplary embodiment, a predictiondirection for selecting neighboring pixels to be used as referencepixels based on pixels included in a coding unit, is set by using a dxparameter and a dy parameter so as to set intra prediction modes havingvarious directionalities in addition to the intra prediction modesdescribed above with reference to FIGS. 16 and 17. For example, wheneach of the 33 prediction modes is defined as mode N_(N is an integerfrom 0 to 32), mode 0, mode 1, mode 2, and mode 3 are set as a verticalmode, a horizontal mode, a DC mode, and a plane mode, respectively, andeach of mode 4 to mode 31 may be set as a prediction mode having adirectionality of tan⁻¹(dy/dx) by using a (dx, dy) parameter expressedwith one from among (1,−1), (1,1), (1,2), (2,1), (1,−2), (2,1), (1,−2),(2,−1), (2,−11), (5,−7), (10,−7), (11,3), (4,3), (1,11), (1,−1),(12,−3), (1,−11), (1,−7), (3,−10), (5,−6), (7,−6), (7,−4), (11,1),(6,1), (8,3), (5,3), (5,7), (2,7), (5,−7), and (4,−3) shown in Table 3.

TABLE 3 mode # dx dy mode 4 1 −1 mode 5 1 1 mode 6 1 2 mode 7 2 1 mode 81 −2 mode 9 2 −1 mode 10 2 −11 mode 11 5 −7 mode 12 10 −7 mode 13 11 3mode 14 4 3 mode 15 1 11 mode 16 1 −1 mode 17 12 −3 mode 18 1 −11 mode19 1 −7 mode 20 3 −10 mode 21 5 −6 mode 22 7 −6 mode 23 7 −4 mode 24 111 mode 25 6 1 mode 26 8 3 mode 27 5 3 mode 28 5 7 mode 29 2 7 mode 30 5−7 mode 31 4 −3 Mode 0, mode 1, mode 2, mode 3, and mode 32 denote avertical mode, a horizontal mode, a DC mode, a plane mode, and aBi-linear mode, respectively.

Mode 32 may be set as a bi-linear mode that uses bi-linear interpolationas will be described later with reference to FIG. 19.

FIGS. 18A through 18C are reference diagrams for explaining intraprediction modes having various directionalities according to exemplaryembodiments. As described above with reference to Table 3, each of intraprediction modes according to exemplary embodiments may havedirectionality of tan⁻¹(dy/dx) by using a plurality of (dx, dy)parameters.

Referring to FIG. 18A, neighboring pixels A and B on a line 180 thatextends from a current pixel P in a current coding unit, which is to bepredicted, at an angle of tan⁻¹(dy/dx) determined by a value of a (dx,dy) parameter according to a mode, shown in Table 3, may be used aspredictors of the current pixel P. In this case, the neighboring pixelsA and B may be pixels that have been encoded and restored, and belong toprevious coding units located above and to the left side of the currentcoding unit. Also, when the line 180 does not pass along neighboringpixels on locations each having an integral value but passes betweenthese neighboring pixels, neighboring pixels closer to the line 180 maybe used as predictors of the current pixel P. If two pixels that meetthe line 180, e.g., the neighboring pixel A located above the currentpixel P and the neighboring pixel B located to the left side of thecurrent pixel P, are present, an average of pixel values of theneighboring pixels A and B may be used as a predictor of the currentpixel P. Otherwise, if a product of values of the dx and dy parametersis a positive value, the neighboring pixel A may be used, and if theproduct of the values of the dx and dy parameters is a negative value,the neighboring pixel B may be used.

FIGS. 18B and 18C are reference diagrams for explaining a process ofgenerating a predictor when the extended line 180 of FIG. 18A passesbetween, not through, neighboring pixels of integer locations.

Referring to FIG. 18B, if the extended line 180 having an angle oftan−1(dy/dx) that is determined according to (dx, dy) of each modepasses between a neighboring pixel A 181 and a neighboring pixel B 182of integer locations, a weighted average value considering a distancebetween an intersection of the extended line 180 and the neighboringpixels A 181 and B 182 close to the extended line 180 may be used as apredictor as described above. For example, if a distance between theneighboring pixel A 181 and the intersection of the extended line 180having the angle of tan−1(dy/dx) is f, and a distance between theneighboring pixel B 182 and the intersection of the extended line 180 isg, a predictor for the current pixel P may be obtained as(A*g+B*f)/(f+g). Here, f and g may be each a normalized distance usingan integer. If software or hardware is used, the predictor for thecurrent pixel P may be obtained by shift operation as (g*A+f*B+2)>>2. Asshown in FIG. 18B, if the extended line 180 passes through a firstquarter close to the neighboring pixel A 181 from among four partsobtained by quartering a distance between the neighboring pixel A 181and the neighboring pixel B 182 of the integer locations, the predictorfor the current pixel P may be acquired as (3*A+B)/4. Such operation maybe performed by shift operation considering rounding-off to a nearestinteger like (3*A+B+2)>>2.

Meanwhile, if the extended line 180 having the angle of tan−1(dy/dx)that is determined according to (dx, dy) of each mode passes between theneighboring pixel A 181 and the neighboring pixel B 182 of the integerlocations, a section between the neighboring pixel A 181 and theneighboring pixel B 182 may be divided into a predetermined number ofareas, and a weighted average value considering a distance between anintersection and the neighboring pixel A 181 and the neighboring pixel B182 in each divided area may be used as a prediction value. For example,referring to FIG. 18C, a section between the neighboring pixel A 181 andthe neighboring pixel B 182 may be divided into five sections P1 throughP5 as shown in FIG. 18C, a representative weighted average valueconsidering a distance between an intersection and the neighboring pixelA 181 and the neighboring pixel B 182 in each section may be determined,and the representative weighted average value may be used as a predictorfor the current pixel P. In detail, if the extended line 180 passesthrough the section P1, a value of the neighboring pixel A may bedetermined as a predictor for the current pixel P. If the extended line180 passes through the section P2, a weighted average value(3*A+1*B+2)>>2 considering a distance between the neighboring pixels Aand B and a middle point of the section P2 may be determined as apredictor for the current pixel P. If the extended line 180 passesthrough the section P3, a weighted average value (2*A+2*B+2)>>2considering a distance between the neighboring pixels A and B and amiddle point of the section P3 may be determined as a predictor for thecurrent pixel P. If the extended line 180 passes through the section P4,a weighted average value (1*A+3*B+2)>>2 considering a distance betweenthe neighboring pixels A and B and a middle point of the section P4 maybe determined as a predictor for the current pixel P. If the extendedline 180 passes through the section P5, a value of the neighboring pixelB may be determined as a predictor for the current pixel P.

Also, if two neighboring pixels, that is, the neighboring pixel A on theup side and the neighboring pixel B on the left side meet the extendedline 180 as shown in FIG. 18A, an average value of the neighboring pixelA and the neighboring pixel B may be used as a predictor for the currentpixel P, or if (dx*dy) is a positive value, the neighboring pixel A onthe up side may be used, and if (dx*dy) is a negative value, theneighboring pixel B on the left side may be used.

The intra prediction modes having various directionalities shown inTable 3 may be predetermined by an encoding side and a decoding side,and only an index of an intra prediction mode of each coding unit may betransmitted.

FIG. 19 is a reference diagram for explaining a bi-linear mode accordingto an exemplary embodiment. Referring to FIG. 19, in the bi-linear mode,a geometric average is calculated by considering a value of a currentpixel P 190 in a current coding unit, which is to be predicted, valuesof pixels on upper, lower, left, and right boundaries of the currentcoding unit, and the distances between the current pixel P 190 and theupper, lower, left, and right boundaries of the current coding unit, andis then used as a predictor of the current pixel P 190. For example, inthe bi-linear mode, a geometric average calculated using a virtual pixelA 191, a virtual pixel B 192, a pixel D 196, and a pixel E 197 locatedto the upper, lower, left, and right sides of the current pixel P 190,and the distances between the current pixel P 190 and the upper, lower,left, and right boundaries of the current coding unit, is used as apredictor of the current pixel P 190. Since the bi-linear mode is one ofintra prediction modes, neighboring pixels that have been encoded andrestored and belong to previous coding units are used as referencepixels for prediction. Thus, pixel values in the current coding unit arenot used but virtual pixel values calculated using neighboring pixelslocated to the upper and left sides of the current coding unit are usedas the pixel A 191 and the pixel B 192.

Specifically, first, a value of a virtual pixel C 193 on a lowerrightmost point of the current coding unit is calculated by calculatingan average of values of a neighboring pixel (right-up pixel) 194 on anupper rightmost point of the current coding unit and a neighboring pixel(left-down pixel) 195 on a lower leftmost point of the current codingunit, as expressed in the following equation:C=0.5 (LeftDownPixel+RightUpPixel)   (4)

The virtual pixel C 193 may be obtained by shifting operation as TheEquation 4 may be the predictor for the current pixel P may be obtainedby shift operation as C=0.5(LeftDownPixel+RightUpPixel+1)>>1.

Next, a value of the virtual pixel A 191 located on a lowermost boundaryof the current coding unit when the current pixel P 190 is extendeddownward by considering the distance W1 between the current pixel P 190and the left boundary of the current coding unit and the distance W2between the current pixel P 190 and the right boundary of the currentcoding unit, is calculated by using the following equation:A=(C*W1+LeftDownPixel*W2)/(W1+W2)A=(C*W1+LeftDownPixel*W2+((W1+W2)/2))/(W1+W2)   (5)

When a value of W1+W2 in Equation 5 is a power of 2, like 2{circumflexover ( )}n, A=(C*W1+LeftDownPixel*W2+((W1+W2)/2))/(W1+W2) may becalculated by shift operation as A=(C*W1+LeftDownPixel*W2+2{circumflexover ( )}(n−1))>>n without division.

Similarly, a value of the virtual pixel B 192 located on a rightmostboundary of the current coding unit when the current pixel P 190 isextended in the right direction by considering the distance h1 betweenthe current pixel P 190 and the upper boundary of the current codingunit and the distance h2 between the current pixel P 190 and the lowerboundary of the current coding unit, is calculated by using thefollowing equation:B=(C*h1+RightUpPixel*h2)/(h1+h2)B=(C*h1+RightUpPixel*h2+((h1+h2)/2))/(h1+h2)   (6)

When a value of h1+h2 in Equation 6 is a power of 2, like 2{circumflexover ( )}m, B=(C*h1+RightUpPixel*h2+((h1+h2)/2))/(h1+h2) may becalculated by shift operation as B=(C*h1+RightUpPixel*h2+2{circumflexover ( )}(m−1))>>m without division.

Once the values of the virtual pixel B 192 on the right border and thevirtual pixel A 191 on the down border of the current pixel P 190 aredetermined by using Equations (4) through (6), a predictor for thecurrent pixel P 190 may be determined by using an average value ofA+B+D+E. In detail, a weighted average value considering a distancebetween the current pixel P 190 and the virtual pixel A 191, the virtualpixel B 192, the pixel D 196, and the pixel E 197 or an average value ofA+B+D+E may be used as a predictor for the current pixel P 190. Forexample, if a weighted average value is used and the size of block is16×16, a predictor for the current pixel P may be obtained as(h1*A+h2*D+W1*B+W2*E+16)>>5. Such bilinear prediction is applied to allpixels in the current coding unit, and a prediction coding unit of thecurrent coding unit in a bilinear prediction mode is generated.

According to an exemplary embodiment, prediction encoding is performedaccording to various intra prediction modes determined according to thesize of a coding unit, thereby allowing efficient video compressionbased on characteristics of an image.

Meanwhile, as described with reference to FIGS. 18A through 18C, if apredictor for the current pixel P is generated by using neighboringpixels on or close to the extended line 180, the extended line 180 hasactually a directivity of tan−1 (dy/dx). In order to calculate thedirectivity, since division (dy/dx) is necessary, calculation is madedown to decimal places when hardware or software is used, therebyincreasing the amount of calculation. Accordingly, a process of settingdx and dy is used in order to reduce the amount of calculation when aprediction direction for selecting neighboring pixels to be used asreference pixels about a pixel in a coding unit is set by using dx, anddy parameters in a similar manner to that described with reference toTable 3.

FIG. 27 is a diagram for explaining a relationship between a currentpixel and neighboring pixels located on an extended line having adirectivity of (dy/dx), according to an exemplary embodiment.

Referring to FIG. 27, it is assumed that a location of the current pixelP is P(j,i), and an up neighboring pixel and a left neighboring pixel Blocated on an extended line 2710 having a directivity, that is, agradient, of tan−1(dy/dx) and passing through the current pixel P arerespectively A and B. When it is assumed that locations of upneighboring pixels correspond to an X-axis on a coordinate plane, andlocations of left neighboring pixels correspond to a y-axis on thecoordinate plate, the up neighboring pixel A is located at(j+i*dx/dy,0), and the left neighboring pixel B is located at(0,i+j*dy/dx). Accordingly, in order to determine any one of the upneighboring pixel A and the left neighboring pixel B for predicting thecurrent pixel P, division, such as dx/dy or dy/dx, is required. Suchdivision is very complex as described above, thereby reducing acalculation speed of software or hardware.

Accordingly, a value of any one of dx and dy representing a directivityof a prediction mode for determining neighboring pixels may bedetermined to be a power of 2. That is, when n and m are integers, dxand dy may be 2{circumflex over ( )}n and 2{circumflex over ( )}m,respectively.

Referring to FIG. 27, if the left neighboring pixel B is used as apredictor for the current pixel P and dx has a value of 2{circumflexover ( )}n, j*dy/dx necessary to determine (0,i+j*dy/dx) that is alocation of the left neighboring pixel B becomes (j*dy/(2{circumflexover ( )}n)), and division using such a power of 2 is easily obtainedthrough shift operation as (j*dy)>>n, thereby reducing the amount ofcalculation.

Likewise, if the up neighboring pixel A is used as a predictor for thecurrent pixel P and dy has a value of 2{circumflex over ( )}m, i*dx/dynecessary to determine (j+i*dx/dy,0) that is a location of the upneighboring pixel A becomes (i*dx)/(2{circumflex over ( )}m), anddivision using such a power of 2 is easily obtained through shiftoperation as (i*dx)>>m.

FIG. 28 is a diagram for explaining a change in a neighboring pixellocated on an extended line having a directivity of (dx,dy) according toa location of a current pixel, according to an exemplary embodiment.

As a neighboring pixel necessary for prediction according to a locationof a current pixel, any one of an up neighboring pixel and a leftneighboring pixel is selected.

Referring to FIG. 28, when a current pixel 2810 is P(j,i) and ispredicted by using a neighboring pixel located in a predictiondirection, an up pixel A is used to predict the current pixel P 2810.When the current pixel 2810 is Q(b,a), a left pixel B is used to predictthe current pixel Q 2820.

If only a dy component of a y-axis direction from among (dx, dy)representing a prediction direction has a power of 2 like 2{circumflexover ( )}m, while the up pixel A in FIG. 24 may be determined throughshift operation without division such as (j+(i*dx)>>m, 0), the leftpixel B requires division such as (0, a+b*2{circumflex over ( )}m/dx).Accordingly, in order to exclude division when a predictor is generatedfor all pixels of a current block, all of dx and dy may have a type ofpower of 2.

FIGS. 29 and 30 are diagrams for explaining a method of determining anintra prediction mode direction, according to exemplary embodiments.

In general, there are many cases where linear patterns shown in an imageor a video signal are vertical or horizontal. Accordingly, when intraprediction modes having various directivities are defined by usingparameters dx and dy, image coding efficiency may be improved bydefining values dx and dy as follows.

In detail, if dy has a fixed value of 2{circumflex over ( )}m, anabsolute value of dx may be set so that a distance between predictiondirections close to a vertical direction is narrow, and a distancebetween prediction modes closer to a horizontal direction is wider. Forexample, referring to FIG. 29, if dy has a value of 2{circumflex over( )}4, that is, 16, a value of dx may be set to be 1,2,3,4,6,9,12,16,0,−1,−2,−3,−4,−6,−9,−12, and −16 so that a distance betweenprediction directions close to a vertical direction is narrow and adistance between prediction modes closer to a horizontal direction iswider.

Likewise, if dx has a fixed value of 2{circumflex over ( )}n, anabsolute value of dy may be set so that a distance between predictiondirections close to a horizontal direction is narrow and a distancebetween prediction modes closer to a vertical direction is wider. Forexample, referring to FIG. 30, if dx has a value of 2{circumflex over( )}4, that is, 16, a value of dy may be set to be 1,2,3,4,6,9,12,16,0,−1,−2,−3,−4,−6,−9,−12, and −16 so that a distance betweenprediction directions close to a horizontal direction is narrow and adistance between prediction modes closer to a vertical direction iswider.

Also, when one of values of dx and dy is fixed, the remaining value maybe set to be increased according to a prediction mode. For example, ifdy is fixed, a distance between dx may be set to be increased by apredetermined value. Also, an angle of a horizontal direction and avertical direction may be divided in predetermined units, and such anincreased amount may be set in each of the divided angles. For example,if dy is fixed, a value of dx may be set to have an increased amount ofa in a section less than 15 degrees, an increased amount of b in asection between 15 degrees and 30 degrees, and an increased width of cin a section greater than 30 degrees. In this case, in order to havesuch a shape as shown in FIG. 27, the value of dx may be set to satisfya relationship of a<b<c.

For example, prediction modes described with reference to FIGS. 27through 30 may be defined as a prediction mode having a directivity oftan−1(dy/dx) by using (dx, dy) as shown in Tables 4 through 6.

TABLE 4 dx Dy dx dy dx dy −32 32 21 32 32 13 −26 32 26 32 32 17 −21 3232 32 32 21 −17 32 32 −26 32 26 −13 32 32 −21 32 32 −9 32 32 −17 −5 3232 −13 −2 32 32 −9 0 32 32 −5 2 32 32 −2 5 32 32 0 9 32 32 2 13 32 32 517 32 32 9

TABLE 4 dx Dy dx dy dx Dy −32 32 19 32 32 10 −25 32 25 32 32 14 9 32 3232 32 19 −14 32 32 −25 32 25 −10 32 32 −19 32 32 −6 32 32 −14 −3 32 32−10 −1 32 32 −6 0 32 32 −3 1 32 32 −1 3 32 32 0 6 32 32 1 10 32 32 3 1432 32 6

TABLE 6 dx Dy dx dy dx dy −32 32 23 32 32 15 −27 32 27 32 32 19 −23 3232 32 32 23 −19 32 32 −27 32 27 −15 32 32 −23 32 32 −11 32 32 −19 −7 3232 −15 −3 32 32 −11 0 32 32 −7 3 32 32 −3 7 32 32 0 11 32 32 3 15 32 327 19 32 32 11

As described above, a predicted coding unit produced using an intraprediction mode determined according to the size of a current codingunit by the predictor 1410 of the intra prediction apparatus 1400 ofFIG. 14, has a directionality according to the intra prediction mode.The directionality in the predicted coding unit may lead to animprovement in prediction efficiency when pixels of the current codingunit that is to be predicted have a predetermined directionality but maylead to a degradation in prediction efficiency when these pixels do nothave a predetermined directionality. Thus, the post-processor 1420 mayimprove prediction efficiency by producing a new predicted coding unitby changing values of pixels in the predicted coding unit by using thepixels in the predicted coding unit and at least one neighboring pixel,as post-processing for the predicted coding unit produced through intraprediction. In this case, the post-processor 1420 does not performpost-processing on all predicted coding units but may performpost-processing only when the determiner 1415 determines that a currentpredicted coding unit does not include a portion located outside aboundary of a picture, that is, when an index MPI_PredMode is not 0.

FIG. 24 is a reference diagram for explaining an indexing process forpost-processing a coding unit according to an exemplary embodiment.Referring to FIG. 24, if a current picture 2410 is divided and encodedinto coding units each having a predetermined size, and a widthFrame_width of the current picture 2410 is not a multiple of ahorizontal length of each of the coding units or a height Frame_heightof the current picture 2410 is not a multiple of a vertical length ofeach of the coding units, then some portion of the coding units (whichare indicated with slant lines) extend over right and lower boundariesof the current picture 2410 as illustrated in FIG. 24. The determiner1415 of FIG. 14 may set a predetermined index MPI_PredMode for thecoding units extending over a boundary of the current picture to be 0,so that the post-processor 1420 of FIG. 14 may skip post-processing ofthese coding units.

A reason why post-processing is not performed when a current predictedcoding unit has a portion located outside a boundary of a current codingunit, is because neighboring pixels of each pixel are used forpost-processing and pixels in the current predicted coding unit lackneighboring pixels. Even if post-processing is performed by producingneighboring pixels through padding or extrapolation, predictionefficiency is not high because the produced neighboring pixels areoriginally non-existent pixels.

FIG. 25 is a reference diagram for explaining an indexing process forpost-processing a coding unit according to another exemplary embodiment.Referring to FIG. 24, if the determiner 1415 of FIG. 14 determines thata coding unit 2520 extends over a boundary 2510 of a picture, then thecoding unit 2520 may be split into deeper coding units of a depth thatis deeper than that of the coding unit 2520, and whether each of thedeeper coding units has a portion located outside a boundary of thepicture may be determined, rather than not post-processing the entirecoding unit 2520. Such a splitting process may be repeatedly performeduntil coding units, e.g., coding units 2524 and 2528, which extend overthe boundary 2510 of the picture are minimum coding units and cannotthus be split any further, that is, until a current depth is a maximumdepth. Referring to FIG. 25, an index MPI_PredMode for the minimumcoding units 2524 and 2528 located outside the boundary 2510 is set to 0so that the minimum coding units 2524 and 2528 may not bepost-processed, and an index MPI_PredMode for minimum coding units 2522and 2526 located within the boundary 2510 is set to be 1 so that theminimum coding units 2522 and 2526 may be post-processed.

A method of post-processing a predicted coding unit by thepost-processor 1420 of FIG. 14 according to an exemplary embodiment,will now be described.

If the determiner 1415 of FIG. 14 determines that a current coding unitdoes not include a portion located outside a boundary of a picture, thenthe post-processor 1420 produces a second predicted coding unit bychanging values of pixels constituting a first predicted coding unitproduced by the predictor 140 of FIG. 14 by performing post-processingusing the pixels of the first predicted coding unit and at least oneneighboring pixel. The predictor 1410 produces the first predictedcoding unit by using an intra prediction mode determined according to asize of the current coding unit, as described above.

FIG. 20 is a reference diagram for explaining post-processing of a firstpredicted coding unit, according to an exemplary embodiment. In FIG. 20,reference numerals 2010 to 2060 illustrate a process of changing valuesof pixels in the first predicted coding unit by the post-processor 1420in chronological order.

Referring to FIG. 20, the post-processor 1420 of FIG. 14 changes valuesof pixels in the first predicted coding unit 2010 by calculating aweighted average of values of a pixel in the first predicted coding unit2010, which is to be changed, and neighboring pixels of the pixel. Forexample, referring to FIG. 20, if a value of a pixel 2021 of the firstpredicted coding unit 2010, which is to be changed, is f[1][1], a valueof a pixel 2022 located above the pixel 2021 is f[0][1], a pixel 2023located to the left side of the pixel 2021 is f[1][0], and a result ofchanging the value f[1][1] of the pixel 2021 is f[1][1], then f[1][1]may be calculated using the following equation:

$\begin{matrix}{{{{{f\lbrack 1\rbrack}\lbrack 1\rbrack} = \left( {{{f\lbrack 0\rbrack}\lbrack 1\rbrack} + {{f\lbrack 1\rbrack}\lbrack 0\rbrack} + \left( {{{f\lbrack 1\rbrack}\lbrack 1\rbrack}\mspace{11mu}{\operatorname{<<}\; 1}} \right) + 2} \right)}\;\operatorname{>>}\; 2}{{{f^{\prime}\lbrack 1\rbrack}\lbrack 1\rbrack} = \frac{{{f\lbrack 0\rbrack}\lbrack 1\rbrack} + {{f\lbrack 1\rbrack}\lbrack 0\rbrack} + {2*{{f\lbrack 1\rbrack}\lbrack 1\rbrack}}}{4}}} & (7)\end{matrix}$

As illustrated in FIG. 20, the post-processor 1420 changes values ofpixels included in the first predicted coding unit 2010 by calculating aweighted average of the values of each pixel of the first predictedcoding unit and pixels located above and to the left side of the pixelin a direction from an upper leftmost point of the first predictedcoding unit to a lower rightmost point of the first predicted codingunit. However, such a post-processing operation according to anotherexemplary embodiment is not limited thereto, and may be sequentiallyperformed on the pixels of the first predicted coding unit in adirection from a upper rightmost point of the first predicted codingunit to a lower leftmost point of the first predicted coding unit or adirection from the lower rightmost point of the first predicted codingunit to the upper leftmost point of the first predicted coding unit. Forexample, if the post-processor 1420 changes the values of the pixels ofthe first predicted coding unit in the direction from the upperrightmost point to the lower leftmost point unlike as illustrated inFIG. 20, then the values of the pixels of the first predicted codingunit are changed by calculating a weighted average of the values of eachof the pixels of the first predicted coding unit and pixels locatedbelow and to the right side of the first predicted coding unit.

FIG. 21 is a reference diagram for explaining an operation of thepost-processor 1420 of FIG. 14 according to an exemplary embodiment.FIG. 22 is a reference diagram for explaining neighboring pixels to beused by a post-processor according to an exemplary embodiment. In FIG.21, reference numeral 2110 denotes a first pixel of a first predictedcoding unit 2100, which is to be changed, and reference numerals 2111 to2118 denote neighboring pixels of the first pixel 2110.

In the current exemplary embodiment (first exemplary embodiment),neighboring pixels of the first pixel 2110 are not limited to thoselocated above and to the left side of the first predicted coding unit,unlike as illustrated in FIG. 20. Referring to FIG. 21, thepost-processor 1420 may post-process the first pixel 2110 by using apredetermined number of neighboring pixels selected from among theneighboring pixels 2111 to 2118. That is, referring to FIG. 22, apredetermined number of pixels are selected from among neighboringpixels P1 to P8 of a first pixel c of a current coding unit, and a valueof the first pixel c is changed by performing a predetermined operationon the selected neighboring pixels and the first pixel c. For example,if the size of the first predicted coding unit 2100 is m×n, a value ofthe first pixel 2110, which is to be changed and is located at an columnand a i^(th) row of the first predicted coding unit 2100, is f[i][j],values of n pixels selected from among the neighboring pixels 2111 to2118 of the first pixel 2110 so as to post-process the first pixel 2110are f1 to fn, respectively, then the post-processor 1420 changes thevalue of the first pixel 2110 from f[i][j] to f[i][j] by using thefollowing equation. Here, m denotes a positive integer, n is 2 or 3, idenotes an integer from 0 to m−1, and j denotes an integer from 0 ton−1.

$\begin{matrix}{{{{f^{\prime}\lbrack i\rbrack}\lbrack j\rbrack} = {\frac{{f\; 1} + {f\; 2} + {2 \times {{f\lbrack i\rbrack}\lbrack j\rbrack}} + 2}{4}\mspace{20mu}\left( {n = 2} \right)}}\;{{{f^{\prime}\lbrack i\rbrack}\lbrack j\rbrack} = {\frac{{f\; 1} + {f\; 2} + {f\; 3} + {{f\lbrack i\rbrack}\lbrack j\rbrack}}{4}\mspace{20mu}\left( {n = 3} \right)}}} & (8)\end{matrix}$

The post-processor 1420 produces a second predicted coding unit bychanging values of all pixels included in the first predicted codingunit 2100 by using Equation (8). In Equation (8), three neighboringpixels are used, but another exemplary embodiment is not limited theretoand the post-processor 1420 may perform post-processing by using four ormore neighboring pixels.

According to a second exemplary embodiment, the post-processor 1420produces a second predicted coding unit by changing the value of eachpixel of the first predicted coding unit 2100 by using a weightedharmonic average of the values of a pixel of the first predicted codingunit 2100, which is to be changed, and neighboring pixels of the pixel.

For example, the post-processor 1420 changes the value of a pixel at thei^(th) column and the j^(th) row of the first predicted coding unit 2100from f[i][j] to f[i][j] by using neighboring pixels located above and tothe left side of the pixel, as shown in the following equation:

$\begin{matrix}{{{{f^{\prime}\lbrack i\rbrack}\lbrack j\rbrack} = \frac{\alpha + \;\beta\; + \;\gamma}{\frac{\alpha}{{f\left\lbrack {i - 1} \right\rbrack}\lbrack j\rbrack} + \frac{\beta}{{f\lbrack i\rbrack}\left\lbrack {j - 1} \right\rbrack} + \frac{\gamma}{{f\lbrack i\rbrack}\lbrack j\rbrack}}},} & (9)\end{matrix}$wherein α, β, and γ denote positive integers, and for example, α=2, β=2,and γ=1.

According to a third exemplary embodiment, the post-processor 1420produces a second predicted coding unit by changing the value of eachpixel of the first predicted coding unit 2100 by using a weightedgeometric average of values of a pixel of the first predicted codingunit 2100, which is to be changed, and neighboring pixels of the pixel.

For example, the post-processor 1420 changes the value of a pixel at thei^(th) column and the j^(th) row of the first predicted coding unit 2100from f[i][j] to f[i][j] by using neighboring pixels located above and tothe left side of the pixel, as shown in the following equation:

$\begin{matrix}{{{{f^{\prime}\lbrack i\rbrack}\lbrack j\rbrack} = \left( {{{f\left\lbrack {i - 1} \right\rbrack}\lbrack j\rbrack}^{\alpha}*{{f\lbrack i\rbrack}\left\lbrack {j - 1} \right\rbrack}^{\beta}*{{f\lbrack i\rbrack}\lbrack j\rbrack}^{\gamma}} \right)^{\frac{1}{({\alpha + \beta + \gamma})}}},} & (10)\end{matrix}$wherein α, β, and γ denote positive integers, and for example, α=1, β=1,and γ=2. In Equation (8) to (10), a relative large weight is assigned tothe value f[i][j] of the pixel that is to be changed.

As described above, in the first to third exemplary embodiments, thepost-processor 1420 may perform post-processing by using not onlyneighboring pixels located above and to the left side of a pixel that isto be changed, but also a predetermined number of neighboring pixelsselected from among the neighboring pixels 2111 to 2118 as illustratedin FIG. 21.

According to a fourth exemplary embodiment, the post-processor 1420produces a second predicted coding unit by changing the value of eachpixel in the first predicted coding unit by using an average of thevalues of a pixel in the first predicted coding unit, which is to bechanged, and one selected from among neighboring pixels of the pixel.

For example, the post-processor 1420 changes the value of a pixel at thei^(th) column and the j^(th) row of the first predicted coding unit 2100from f[i][j] to f[i][j] by using neighboring pixels located above thepixel, as shown in the following equation:f[i][j]=(f[i−1][j]+f[i][j−1]+1)>>1   (11)

Similarly, according to a fifth exemplary embodiment, the post-processor1420 produces a second predicted coding unit by changing the value ofeach pixel in the first predicted coding unit by using an average of thevalues of a pixel in the first predicted coding unit, which is to bechanged, and neighboring pixels located to the left side of the pixel.

In other words, the post-processor 1420 changes the value of a pixel atthe i^(th) column and the j^(th) row of the first predicted coding unit2100 from f[i][j] to f[i][j], as shown in the following equation:f[i][j]=(f[i−1][j]+f[i][j]+1)>>1   (12)

According to a sixth exemplary embodiment, the post-processor 1420produces a second predicted coding unit by changing the value of eachpixel in the first predicted coding unit by using a median between thevalues of a pixel of the first predicted coding unit, which is to bechanged, and neighboring pixels of the pixel. Referring back to FIG. 21,for example, it is assumed that the value f[i][j] of the first pixel2110 at the i^(th) column and the i^(th) row of the first predictedcoding unit 2100, the value f[i][j−1] of the second pixel 2112, and thevalue f[i−1][j] of the third pixel 2111 have a relation off[i][j−1]>f[i−1][j]>f[i][j], in terms of block size. In this case, thepost-processor 1420 changes the value f[i][j] of the first pixel 2110 tothe median f[i−1][j] among the first to third pixels 2110 to 2112.

In seventh to ninth exemplary embodiments, the post-processor 1420produces a second predicted coding unit by using previous coding unitsadjacent to a current coding unit, which have been encoded and restored,rather than by using neighboring pixels of a pixel that is to bechanged.

Referring back to FIG. 21, in the seventh exemplary embodiment, thepost-processor 1420 changes the value of the first pixel 2110 to f[i][j]by calculating an average of the value of the first pixel 2110 at thei^(th) column and the j^(th) row of the first predicted coding unit 2100and the value of the pixel 2121 that is located at the same column asthe first pixel 2110 and included in a coding unit adjacent to the topof the current coding unit, as shown in the following equation:f[i][j]=(f[i][j]+f[−1][j]+1)>>1   (13),wherein f[−1][j] denotes the value of the pixel 2121.

Similarly, in the eighth exemplary embodiment, the post-processor 1420changes the value of the first pixel 2110 to f[i][j] by calculating anaverage of the value of the first pixel 2110 at the i^(th) column andthe j^(th) row of the first predicted coding unit 2100 and the value ofthe pixel 2122 that is located at the same row as the first pixel 2110and included in a coding unit adjacent to the left side of the currentcoding unit, as shown in the following equation:f[i][j]=(f[i][j]+f[j][−1]+1)>>1   (14),wherein f[i][−1] denotes the value of the pixel 2122.

In the ninth exemplary embodiment, the post-processor 1420 changes thevalue of the first pixel 2110 to f[i][j] by calculating a weightedaverage of the values of the first pixel 2110 at the i^(th) column andthe j^(th) row of the first predicted coding unit 2100, the pixel 2121located at the same column as the first pixel 2110 and included in acoding unit adjacent to the top of the current coding unit, and thepixel 2122 located at the same row as the first pixel 2110 and includedin a coding unit adjacent to the left side of the current coding unit,as shown in the following equation:f′[i][j]=((f[i][j]<<1)+f[j][−1]+f[i][j−1]+2)>>2  (15)

In a tenth exemplary embodiment, the post-processor 1420 changes thevalue of the first pixel 2110 of the first predicted coding unit 2100,which is to be changed, from f[i][j] to f[i][j] by using one of thefollowing equations.f′[i][j]=min(f[i][j]+i,255)  (16)f′[i][j]min(f[i][j]+j,255)  (17)f′[i][j]=max(f[i][j]−i,0)  (18)f′[i][j]max(f[i][j]−j,0)  (19)

In Equation (16), the pixel values of the first predicted coding unit2100 are changed to gradually increase from top to bottom, in columnunits of the first predicted coding unit 2100. In Equation (17), thepixel values of the first predicted coding unit 2100 are changed togradually increase in a right direction, in row units of the firstpredicted coding unit 2100. In Equation (18), the pixel values of thefirst predicted coding unit 2100 are changed to gradually decrease fromtop to bottom, in column units of the first predicted coding unit 2100.In Equation (19), the pixel values of the first predicted coding unit2100 are changed to gradually decrease in the right direction, in rowunits of the first predicted coding unit 2100.

In an eleventh exemplary embodiment, if the value of the first pixel2110, which is located at the i^(th) column and the j^(th) row of thefirst predicted coding unit 2100 and is to be changed, is f[i][j], thevalue of a pixel located at an upper leftmost point of the firstpredicted coding unit 2100 is f[0][0], the value of a pixel located atthe j^(th) column as the first pixel 2110 and at the uppermost point ofthe first predicted coding unit 2100 is f[0][j], the value of a pixellocated at the i^(th) row as the first pixel 2110 and at the leftmostpoint of the first predicted coding unit is f[i][0], andG[i][j]=f[i][0]+f[0][j]−f[0][0],then the post-processor 1420 changes the value of the first pixel 2110to f[i][j], as shown in the following equation:f′[i][j]=(f[i][j]+G[i][j])/2  (20)

Equation (20) is based on a wave equation, in which the value of eachpixel in the first predicted coding unit 2100 is changed by calculatingthe value G[i][j] by setting the values of a pixel on the uppermostpoint of and a pixel on the leftmost point of the first predicted codingunit 2100 to be boundary conditions so as to smooth the value of eachpixel in the first predicted coding unit 2100, and then calculating anaverage of the values G[i][j] and f[i][j].

Also, if a value of a first pixel at an x^(th) column and an y^(th) rowof the first predicted coding unit, which is to be changed, is f[x][y]and values of neighboring pixels located above, below, and to the leftand right sides of the first pixel are f[x−1][y], f[x+1][y], f[x][y−1],and f[x][y+1], respectively, then the post-processor 1420 may change thevalue of the first pixel to f[x][y] by using one of the followingshifting operations:f[x,y]=(f[x,y]+f[x−1,y]+f[x,y−1]+f[x,y+1]+2)>>2f[x,y]=(f[x,y]+f[x−1,y]+f[x,y−1]+f[x−1,y−1]+2)>>2f[x,y]=(2*f[x,y]+f[x+1,y]+f[x,y−1]+2)>>2f[x,y]=(2*f[x,y]+f[x−1,y]+f[x,y−1]+2)>>2f[x,y]=(f[x,y]+f[x+1,y]+f[x,y+1]+f[x,y−1]+2)>>2f[x,y]=(f[x,y]+f[x−1,y]+f[x,y+1]+f[x,y−1]+2)>>2

Also, the post-processor 1420 may produce a median by using the firstpixel and neighboring pixels of the first pixel, and change the value ofthe first pixel by using the median. For example, the value of the firstpixel may be changed by setting a median t[x,y] by using an equation: t[x,y]=(2*f[x,y]+f[x−1,y]+f[x,y−1]+2)>>2, f[x,y]=t[x,y]. Similarly, themedian t[x,y] between the first pixel and the neighboring pixels may becalculated using an equation: t[x,y]=median (f[x,y],f[x−1, y],f[x,y−1]),and may be determined as a changed value of the first pixel.

Also, the post-processor 1420 may change the value of the first pixel byusing the following operation:

{ t[x,y] = f[x,y] for (Int iter=0; iter<iterMax; iter++) {laplacian[x,y] = (t[x,y]<<2) − t[x−1,y]− t[x+1,y]− t[x,y−1]− t[x,y+1] t[x,y] =(α* t [x,y] + laplacian[x,y] )/ α } f[x,y] = t[x,y] }

Here, iterMax may be 5, and a may be 16.

Costs of bitstreams containing results of encoding second predictedcoding units produced using various post-processing modes according tothe above first through eleventh embodiments, respectively, are comparedto one another, and then, the post-processing mode having the minimumcost is added to a header of a bitstream from among the variouspost-processing modes. When the post-processing mode is added to thebistream, it is possible to represent different post-processing modes tobe differentiated from one another by using variable-length coding, inwhich a small number of bits are assigned to a post-processing mode thatis most frequently used, based on a distribution of the post-processingmode determined after encoding of a predetermined number of coding unitsis completed. For example, if a post-processing mode according to thefirst exemplary embodiment is an optimum operation leading to theminimum cost of most coding units, a minimum number of bits are assignedto an index indicating this post-processing mode so that thispost-processing mode may be differentiated from the otherpost-processing modes.

When a coding unit is split to sub coding units and prediction isperformed in the sub coding units, a second predicted coding unit may beproduced by applying different post-processing modes to the sub codingunits, respectively, or by applying the same post-processing mode to subcoding units belonging to the same coding unit so as to simplifycalculation and decrease an overhead rate.

A rate-distortion optimization method may be used as a cost fordetermining an optimum post-processing mode. Since a video encodingmethod according to an exemplary embodiment is performed on an intrapredicted coding unit used as reference data for another coding unit, acost may be calculated by allocating a high weight to a distortion,compared to the rate-distortion optimization method. That is, in therate-distortion optimization method, a cost is calculated, based on adistortion that is the difference between an encoded image and theoriginal image and a bitrate generated, as shown in the followingequation:Cost=distortion+bit-rate   (21)

In contrast, in a video encoding method according to an exemplaryembodiment, an optimum post-processing mode is determined by allocatinga high weight to a distortion, compared to the rate-distortionoptimization method, as shown in the following equation:Cost=α*distortion+bit-rate (α denotes a real number equal to or greaterthan 2)   (22)

FIG. 23 is a flowchart illustrating a method of encoding video accordingto an exemplary embodiment. Referring to FIG. 23, in operation 2310, afirst predicted coding unit of a current coding unit that is to beencoded, is produced. The first predicted coding unit is an intrapredicted block produced by performing a general intra predictionmethod, and one of various intra prediction modes having variousdirectionalities, which is determined by the size of a coding unit.

In operation 2320, it is determined whether the current coding unit hasa portion located outside a boundary of a current picture. Apredetermined index MPI_PredMode may be produced according to thedetermination result, in such a manner that post-processing forproducing a second predicted coding unit will not be performed when thepredetermined index MPI_PredMode is 0 and will be performed when thepredetermined index MPI_PredMode is 1.

If it is determined in operation 2320 that the current coding unit doesnot have a portion located outside a boundary of the current picture,then a second predicted coding unit is produced by changing a value ofeach pixel of the first predicted coding unit by using each pixel of thefirst predicted coding unit and at least one neighboring pixel, inoperation 2330. As described above in the first through eleventhexemplary embodiments regarding an operation of the post-processor 1420,a second predicted coding unit may be produced by changing the value ofeach pixel in the first predicted coding unit by performing one ofvarious post-processing modes on a pixel of the first predicted codingunit, which is to be changed, and neighboring pixels thereof. Then, aresidual block that is the difference between the second predictedcoding unit and the current coding unit, is transformed, quantized, andentropy encoded so as to generate a bitstream. Information regarding thepost-processing mode used to produce the second predicted coding unitmay be added to a predetermined region of the bitstream, so that adecoding apparatus may reproduce the second predicted coding unit of thecurrent coding unit.

If it is determined in operation 2320 that the current coding unit has aportion located outside a boundary of the current picture, then, asecond predicted coding unit is not produced, and the first predictedcoding unit is directly output as prediction information regarding thecurrent coding unit, in operation 2340. Then, a residual block that isthe difference between the first predicted coding unit and the currentcoding unit, is transformed, quantized, and entropy encoded so as togenerate a bitstream.

FIG. 26 is a flowchart illustrating a method of decoding video accordingto an exemplary embodiment. Referring to FIG. 26, in operation 2610,information regarding a prediction mode related to a current decodingunit that is to be decoded, is extracted from a received bitstream.

In operation 2620, a first predicted decoding unit of the currentdecoding unit is produced according to the extracted information.

In operation 2630, it is determined whether the current decoding unithas a portion located outside a boundary of a current picture. Apredetermined index MPI_PredMode may be produced according to thedetermination result, in such a manner that post-processing forproducing a second predicted decoding unit will not be performed whenthe predetermined index MPI_PredMode is 0 and will be performed when thepredetermined index MPI_PredMode is 1.

If it is determined in operation 2630 that the current decoding unitdoes not have a portion located outside a boundary of the currentpicture, a second predicted decoding unit is produced by changing avalue of each pixel of the first predicted decoding unit by using eachpixel of the first predicted decoding unit and neighboring pixels ofeach pixel, in operation 2640. As described above in the first througheleventh exemplary embodiments regarding an operation of thepost-processor 1420, a second predicted coding unit may be produced bychanging the value of each pixel of the first predicted coding unit byusing performing one of various post-processing modes on a pixel of thefirst predicted coding unit, which is to be changed, and neighboringpixels thereof.

If it is determined in operation 2630 that that the current decodingunit has a portion located outside a boundary of the current picture,post-processing for producing a second predicted decoding unit is notperformed and the first predicted decoding unit is directly output asprediction information regarding the current decoding unit, in operation2650. The first predicted decoding unit is combined with a residualblock of the current decoding unit, which is extracted from thebitstream, so as to reproduce the current decoding unit.

An exemplary embodiment can also be embodied as computer readable codeon a computer readable recording medium. The computer readable recordingmedium is any data storage device that can store data which can bethereafter read by a computer system. Examples of the computer readablerecording medium include read-only memory (ROM), random-access memory(RAM), CD-ROMs, magnetic tapes, floppy disks, and optical data storagedevices. The computer readable recording medium can also be distributedover network coupled computer systems so that the computer readable codeis stored and executed in a distributed fashion.

Exemplary embodiments can also be implemented as computer processors andhardware devices.

While exemplary embodiments have been particularly shown and describedabove, it will be understood by one of ordinary skill in the art thatvarious changes in form and details may be made therein withoutdeparting from the spirit and scope of the inventive concept as definedby the following claims. The exemplary embodiments should be consideredin a descriptive sense only and not for purposes of limitation.Therefore, the scope of the inventive concept is defined not by thedetailed description of exemplary embodiments but by the followingclaims, and all differences within the scope will be construed as beingincluded in the present inventive concept.

What is claimed is:
 1. A method of decoding video, the methodcomprising: extracting information regarding a prediction mode for acurrent decoding unit, which is to be decoded, from a receivedbitstream; producing a first predicted decoding unit of the currentdecoding unit, based on the extracted information; determining whetherthe current decoding unit includes a portion located outside a boundaryof a current picture; and producing a second predicted decoding unit bychanging values of pixels of the first predicted decoding unit by usingpixels of the first predicted decoding unit and neighboring pixels ofthe pixels when the current decoding unit does not include the portionlocated outside the boundary of the current picture, and skipping theproducing the second predicted decoding unit when the current decodingunit includes the portion located outside the boundary of the currentpicture.
 2. The method of claim 1, wherein the determining whether thecurrent decoding unit includes the portion located outside the boundaryof the current picture comprises obtaining index information indicatingwhether the producing the second predicted decoding unit is to beperformed.
 3. The method of claim 2, wherein: if the index informationhas a first predetermined value, the index information indicates thatthe producing the second predicted decoding unit is not to be performed;and if the index information has a second predetermined value, the indexinformation indicates that the producing the second predicted decodingunit is to be performed.
 4. An apparatus for decoding video, theapparatus comprising: an entropy decoder which extracts informationregarding a prediction mode for a current decoding unit, which is to bedecoded, from a received bitstream; a predictor which produces a firstpredicted decoding unit of the current decoding unit, based on theextracted information; a determiner which determines whether the currentdecoding unit includes a portion located outside a boundary of a currentpicture; and a post-processor which produces a second predicted decodingunit by changing values of pixels of the first predicted decoding unitby using the pixels of the first predicted decoding unit and neighboringpixels of the pixels when the current decoding unit does not include theportion located outside the boundary of the current picture, and whichskips the producing the second predicted decoding unit when the currentdecoding unit includes the portion located outside the boundary of thecurrent picture.
 5. The apparatus of claim 4, wherein the determinerobtains index information indicating whether a process of producing thesecond predicted decoding unit is to be performed.
 6. The apparatus ofclaim 5, wherein: if the index information has a first predeterminedvalue, the index information indicates that the process of producing thesecond predicted decoding unit is not to be performed; and if the indexinformation has a second predetermined value, the index informationindicates that the process of producing the second predicted decodingunit is to be performed.
 7. A non-transitory computer readable recordingmedium having recorded thereon a program code for executing the methodof claim
 1. 8. A method of restoring an encoded block, the methodexecuted by one or more processors and comprising: splitting, by the oneor more processors, an image into a plurality of maximum coding unitsbased on information about a size of a maximum coding unit; determining,by the one or more processors, at least one coding unit included in themaximum coding unit among the plurality of maximum coding units bysplitting the maximum coding unit based on split information;extracting, by the one or more processors, information regarding aprediction mode of a current block included in the at least one codingunit, from a received bitstream; determining, by the one or moreprocessors, neighboring pixels of the current block used for intraprediction by using available neighboring pixels of the current blockwhen the extracted information indicates the prediction mode of thecurrent block is intra prediction; producing, by the one or moreprocessors, a first prediction value of the current block including afirst pixel located on a top border in the current block and a secondpixel located on a left border in the current block and a third pixellocated on a upper left corner in the current block, by calculating anaverage value of at least one of the available neighboring pixelsadjacent to the current block; producing, by the one or more processors,a second prediction value of the first pixel by using a weighted averagevalue of the first prediction value and a pixel value of one neighboringpixel adjacent to the first pixel and located on a same column with thefirst pixel, a second prediction value of the second pixel by using aweighted average value of the first prediction value and a pixel valueof one neighboring pixel adjacent to the second pixel and located on asame row with the second pixel, and a second prediction value of thethird pixel by using a weighted average value of the first predictionvalue, a pixel value of one neighboring pixel adjacent to the thirdpixel and located on a same column with the third pixel, and a pixelvalue of one neighboring pixel adjacent to the third pixel and locatedon a same row with the third pixel; obtaining, by the one or moreprocessors, a residual of the first pixel, a residual of the secondpixel and a residual of the third pixel from the received bitstream;restoring, by the one or more processors, the current block including arestored pixel value of the first pixel obtained by adding the residualof the first pixel and the second prediction value of the first pixel, arestored pixel value of the second pixel obtained by adding the residualof the second pixel and the second prediction value of the second pixel,a restored pixel value of the third pixel obtained by adding theresidual of the third pixel and the second prediction value of the thirdpixel; and outputting, by the one or more processors, a restored currentblock including the restored pixel value of the first pixel, therestored pixel value of the second pixel, and the restored pixel valueof the third pixel, wherein, when the neighboring pixels of the currentblock are located within a boundary of a current picture, theneighboring pixels of the current block located within the boundary of acurrent picture are determined as available.
 9. A method of encodingvideo, the method executed by one or more processors comprising:splitting, by the one or more processors, an image into a plurality ofmaximum coding units based on information about a size of a maximumcoding unit; determining, by the one or more processors, at least onecoding unit included in the maximum coding unit among the plurality ofmaximum coding units by splitting the maximum coding unit based on splitinformation; determining, by the one or more processors, neighboringpixels of a current block used for intra prediction by using availableneighboring pixels of the current block when a prediction mode of thecurrent block is intra prediction; producing, by the one or moreprocessors, a first prediction value of the current block including afirst pixel located on a top border in the current block and a secondpixel located on a left border in the current block and a third pixellocated on a upper left corner in the current block, by calculating anaverage value of at least one of the available neighboring pixelsadjacent to the current block; producing, by the one or more processors,a second prediction value of the first pixel by using a weighted averagevalue of the first prediction value and a pixel value of one neighboringpixel adjacent to the first pixel and located on a same column with thefirst pixel, a second prediction value of the second pixel by using aweighted average value of the first prediction value and a pixel valueof one neighboring pixel adjacent to the second pixel and located on asame row with the second pixel, and a second prediction value of thethird pixel by using a weighted average value of the first predictionvalue, a pixel value of one neighboring pixel adjacent to the thirdpixel and located on a same column with the third pixel, and a pixelvalue of one neighboring pixel adjacent to the third pixel and locatedon a same row with the third pixel; obtaining, by the one or moreprocessors, a residual of the current block including a first residualof the first pixel obtained by using the second prediction value of thefirst pixel, a second residual of the second pixel obtained by using thesecond prediction value of the second pixel and a third residual of thethird pixel obtained by using the second prediction value of the thirdpixel; and outputting the prediction mode of the current block, thefirst residual of the first pixel, the second residual of the secondpixel and the third residual of the third pixel into a bitstream,wherein, when the neighboring pixels of the current block are locatedwithin boundary of a current picture, the neighboring pixels of thecurrent block located within the boundary of a current picture aredetermined as available.
 10. An apparatus comprising a non-transitorycomputer-readable storage medium storing thereon instructions that, whenexecuted by one or more processors of the apparatus, cause the one ormore processors to execute operations to generate image datacorresponding to a video bitstream, the image data comprising: anencoded data obtained by performing intra prediction on a current block;and an intra prediction mode information of the current block, whereinthe operations, executed using the at least one processor of theapparatus, include: splitting an image into a plurality of maximumcoding units and generating information about a size of a maximum codingunit, determining at least one coding unit included in the maximumcoding unit among the plurality of maximum coding units by splitting themaximum coding unit and generating split information, determiningneighboring pixels of the current block used for intra prediction byusing available neighboring pixels of the current block, producing afirst prediction value of the current block including a first pixellocated on a top border in the current block and a second pixel locatedon a left border in the current block and a third pixel located on aupper left corner in the current block, by calculating an average valueof at least one of the available neighboring pixels adjacent to thecurrent block, and producing a second prediction value of the firstpixel by using a weighted average value of the first prediction valueand a pixel value of one neighboring pixel adjacent to the first pixeland located on a same column with the first pixel, a second predictionvalue of the second pixel by using a weighted average value of the firstprediction value and a pixel value of one neighboring pixel adjacent tothe second pixel and located on a same row with the second pixel, and asecond prediction value of the third pixel by using a weighted averagevalue of the first prediction value, a pixel value of one neighboringpixel adjacent to the third pixel and located on a same column with thethird pixel, and a pixel value of one neighboring pixel adjacent to thethird pixel and located on a same row with the third pixel, wherein theencoded data includes a residual of the current block including a firstresidual of the first pixel obtained by using the second predictionvalue of the first pixel, a second residual of the second pixel obtainedby using the second prediction value of the second pixel and a thirdresidual of the third pixel obtained by using the second predictionvalue of the third pixel, and wherein, when the neighboring pixels ofthe current block are located within boundary of a current picture, theneighboring pixels of the current block located within the boundary of acurrent picture are determined as available.